From ea6160b910d6a467e00b2f0bf193e501d0afee4a Mon Sep 17 00:00:00 2001 From: winlin Date: Sat, 11 Nov 2023 17:29:02 +0800 Subject: [PATCH] Use upx to make binary smaller. v5.11.16 --- focal/Dockerfile | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/focal/Dockerfile b/focal/Dockerfile index c8fd1dd8..fdf4e1ae 100644 --- a/focal/Dockerfile +++ b/focal/Dockerfile @@ -2,19 +2,33 @@ ARG ARCH FROM ${ARCH}ossrs/srs:ubuntu20 AS build FROM ${ARCH}redis:5.0 AS redis + FROM ${ARCH}goacme/lego AS lego +# https://github.com/upx/upx +FROM ${ARCH}ubuntu:focal AS upx + +# 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 + +COPY --from=lego /lego /usr/local/bin/ +RUN upx --best --lzma /usr/local/bin/lego + +COPY --from=build /usr/local/bin/ffmpeg /usr/local/bin/ffprobe /usr/local/bin/ +RUN upx --best --lzma /usr/local/bin/ffmpeg +RUN upx --best --lzma /usr/local/bin/ffprobe + # http://releases.ubuntu.com/focal/ FROM ${ARCH}ubuntu:focal AS dist # certs: For HTTPS client, or failed as: x509: certificate signed by unknown authority # redis: For redis server and tools. # lego: For ACME client, request and renew the HTTPS certificate. -COPY --from=build /usr/local/bin/ffmpeg /usr/local/bin/ffprobe /usr/local/bin/ COPY --from=build /etc/ssl/certs /etc/ssl/certs COPY --from=build /usr/share/ca-certificates /usr/share/ca-certificates COPY --from=redis /usr/local/bin/redis-cli /usr/local/bin/redis-server /usr/local/bin/ -COPY --from=lego /lego /usr/local/bin/ +COPY --from=upx /usr/local/bin/lego /usr/local/bin/ffmpeg /usr/local/bin/ffprobe /usr/local/bin/ # We write the common config for platform to base image, however you can # overwrite it if not for platform, for example, used in releases.