From 2823583e1bdf3670591905f6bb2da0caac53c80f Mon Sep 17 00:00:00 2001 From: winlin Date: Wed, 27 Sep 2023 16:53:21 +0800 Subject: [PATCH] Udpate cache. --- .github/workflows/release.yml | 9 +++++---- Dockerfile | 16 ++++++++++------ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f0e5c7a..d0e1c9f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -59,11 +59,12 @@ jobs: with: username: "${{ secrets.DOCKER_USERNAME }}" password: "${{ secrets.DOCKER_PASSWORD }}" - - name: Build and push to docker registry + - name: Build docker image run: | - docker buildx build --platform linux/arm/v7,linux/arm64/v8,linux/amd64 \ - --output "type=image,push=true" \ - -t ossrs/srs:$SRS_TAG . + docker build --tag ossrs/srs:$SRS_TAG . + - name: Push to docker hub + run: | + docker push ossrs/srs:$SRS_TAG outputs: SRS_DOCKER_PROD_DONE: ok diff --git a/Dockerfile b/Dockerfile index e0af9cf..ec93bfd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,8 +8,9 @@ FROM ${ARCH}ossrs/srs:ubuntu20 as build ARG BUILDPLATFORM ARG TARGETPLATFORM +ARG TARGETARCH ARG JOBS=2 -RUN echo "BUILDPLATFORM: $BUILDPLATFORM, TARGETPLATFORM: $TARGETPLATFORM, JOBS: $JOBS" +RUN echo "BUILDPLATFORM: $BUILDPLATFORM, TARGETPLATFORM: $TARGETPLATFORM, TARGETARCH: $TARGETARCH, JOBS: $JOBS" # https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image ENV DEBIAN_FRONTEND noninteractive @@ -51,8 +52,10 @@ RUN mkdir -p /usr/local/srs-cache RUN cd /usr/local/srs-cache && git clone https://github.com/ossrs/srs.git # Setup the SRS trunk as workdir. WORKDIR /usr/local/srs-cache/srs/trunk -RUN git checkout 5.0release && ./configure --jobs=${JOBS} --cross-build --cross-prefix=aarch64-linux-gnu- && make -j${JOBS} -RUN git checkout develop && ./configure --jobs=${JOBS} --cross-build --cross-prefix=aarch64-linux-gnu- && make -j${JOBS} +RUN if [[ $TARGETARCH != 'arm' && $TARGETARCH != 'arm64' ]]; then \ + git checkout 5.0release && ./configure --jobs=${JOBS} --cross-build --cross-prefix=aarch64-linux-gnu- && make -j${JOBS} && \ + git checkout develop && ./configure --jobs=${JOBS} --cross-build --cross-prefix=aarch64-linux-gnu- && make -j${JOBS}; \ + fi RUN du -sh /usr/local/srs-cache/srs/trunk/objs/* #------------------------------------------------------------------------------------ @@ -63,8 +66,9 @@ FROM ${ARCH}ubuntu:focal as dist ARG BUILDPLATFORM ARG TARGETPLATFORM +ARG TARGETARCH ARG JOBS=2 -RUN echo "BUILDPLATFORM: $BUILDPLATFORM, TARGETPLATFORM: $TARGETPLATFORM, JOBS: $JOBS" +RUN echo "BUILDPLATFORM: $BUILDPLATFORM, TARGETPLATFORM: $TARGETPLATFORM, TARGETARCH: $TARGETARCH, JOBS: $JOBS" WORKDIR /tmp/srs @@ -114,12 +118,12 @@ RUN which cmake && cmake --version #RUN ln -sf /usr/local/googletest-release-1.6.0 /usr/local/gtest # Install 32bits adapter for crossbuild. -RUN if [[ $TARGETPLATFORM != 'linux/arm/v7' && $TARGETPLATFORM != 'linux/arm64/v8' && $TARGETPLATFORM != 'linux/arm64' ]]; then \ +RUN if [[ $TARGETARCH != 'arm' && $TARGETARCH != 'arm64' ]]; then \ apt-get -y install lib32z1-dev; \ fi # For cross-build: https://github.com/ossrs/srs/wiki/v4_EN_SrsLinuxArm#ubuntu-cross-build-srs -RUN if [[ $TARGETPLATFORM != 'linux/arm/v7' && $TARGETPLATFORM != 'linux/arm64/v8' && $TARGETPLATFORM != 'linux/arm64' ]]; then \ +RUN if [[ $TARGETARCH != 'arm' && $TARGETARCH != 'arm64' ]]; then \ apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf \ gcc-aarch64-linux-gnu g++-aarch64-linux-gnu; \ fi