1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Speedup the test from srs-cache image.

This commit is contained in:
winlin 2022-06-17 14:18:27 +08:00
parent c722eba48f
commit f92fb9653b
2 changed files with 18 additions and 3 deletions

View file

@ -151,6 +151,7 @@ jobs:
run: | run: |
docker buildx build --platform linux/arm/v7,linux/arm64/v8,linux/amd64 \ docker buildx build --platform linux/arm/v7,linux/arm64/v8,linux/amd64 \
--output "type=image,push=false" \ --output "type=image,push=false" \
--build-arg IMAGE=ossrs/srs:ubuntu20-cache \
-f trunk/Dockerfile . -f trunk/Dockerfile .
done: done:

View file

@ -1,5 +1,6 @@
ARG ARCH ARG ARCH
FROM ${ARCH}ossrs/srs:ubuntu20 AS build ARG IMAGE=ossrs/srs:ubuntu20
FROM ${ARCH}${IMAGE} AS build
ARG BUILDPLATFORM ARG BUILDPLATFORM
ARG TARGETPLATFORM ARG TARGETPLATFORM
@ -10,13 +11,26 @@ RUN echo "BUILDPLATFORM: $BUILDPLATFORM, TARGETPLATFORM: $TARGETPLATFORM, JOBS:
# https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image # https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
# To use if in RUN, see https://github.com/moby/moby/issues/7281#issuecomment-389440503
# Note that only exists issue like "/bin/sh: 1: [[: not found" for Ubuntu20, no such problem in CentOS7.
SHELL ["/bin/bash", "-c"]
# Install depends tools. # Install depends tools.
RUN apt-get update && apt-get install -y gcc make g++ patch unzip perl git RUN apt-get update && apt-get install -y gcc make g++ patch unzip perl git
# Build and install SRS. # Copy source code to docker.
# Note that SRT is enabled by default, so we configure without --srt=on.
COPY . /srs COPY . /srs
WORKDIR /srs/trunk WORKDIR /srs/trunk
# Use srs-cache from base image.
RUN if [[ -d /usr/local/srs-cache/srs/trunk/objs ]]; then \
echo "Build from cache of base image" && mkdir -p objs && \
cp -R /usr/local/srs-cache/srs/trunk/objs/Platform-* objs/ && \
du -sh objs/*; \
fi
# Build and install SRS.
# Note that SRT is enabled by default, so we configure without --srt=on.
RUN ./configure --jobs=${JOBS} && make -j${JOBS} && make install RUN ./configure --jobs=${JOBS} && make -j${JOBS} && make install
# All config files for SRS. # All config files for SRS.