From 30f7bdd8c6dbd795bd9f00dd09cacef94a2cb3b4 Mon Sep 17 00:00:00 2001 From: winlin Date: Sat, 11 Nov 2023 17:58:28 +0800 Subject: [PATCH] Use docker compress for image. v5.11.16 --- .github/workflows/focal.yml | 2 +- focal/Dockerfile | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/focal.yml b/.github/workflows/focal.yml index 9a524607..4cf57be6 100644 --- a/.github/workflows/focal.yml +++ b/.github/workflows/focal.yml @@ -58,7 +58,7 @@ jobs: run: | echo "Release ossrs/srs-stack:$SRS_TAG" docker buildx build --platform linux/amd64,linux/arm/v7,linux/arm64/v8 \ - --output "type=image,push=true" \ + --output "type=image,push=true" --compress \ --tag ossrs/srs-stack:$SRS_TAG -f focal/Dockerfile . - name: Docker alias images for ossrs/srs-stack uses: akhilerm/tag-push-action@v2.1.0 diff --git a/focal/Dockerfile b/focal/Dockerfile index ec5e0eac..cd85151c 100644 --- a/focal/Dockerfile +++ b/focal/Dockerfile @@ -8,6 +8,11 @@ FROM ${ARCH}goacme/lego AS lego # https://github.com/upx/upx FROM ${ARCH}ubuntu:focal AS upx +ARG BUILDPLATFORM +ARG TARGETPLATFORM +ARG TARGETARCH +RUN echo "BUILDPLATFORM: $BUILDPLATFORM, TARGETPLATFORM: $TARGETPLATFORM, TARGETARCH: $TARGETARCH" + # https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update -y && apt-get install -y upx @@ -16,13 +21,13 @@ COPY --from=lego /lego /usr/local/bin/ COPY --from=build /usr/local/bin/ffmpeg /usr/local/bin/ffprobe /usr/local/bin/ COPY --from=redis /usr/local/bin/redis-cli /usr/local/bin/redis-server /usr/local/bin/ -RUN echo "Before UPX" && ls -lh /usr/local/bin && \ +RUN echo "Before UPX for $TARGETARCH" && ls -lh /usr/local/bin && \ upx --best --lzma /usr/local/bin/lego && \ upx --best --lzma /usr/local/bin/ffmpeg && \ upx --best --lzma /usr/local/bin/ffprobe && \ upx --best --lzma /usr/local/bin/redis-cli && \ upx --best --lzma /usr/local/bin/redis-server && \ - echo "After UPX" && ls -lh /usr/local/bin + echo "After UPX for $TARGETARCH" && ls -lh /usr/local/bin # http://releases.ubuntu.com/focal/ FROM ${ARCH}ubuntu:focal AS dist