Add UPX executable compression to Docker build in order to reduce binary and docker image sizes significantly

This commit is contained in:
James Eversole 2022-12-29 17:57:34 -06:00
parent d5fa1ffd7a
commit 84c49319a6

View File

@ -1,10 +1,18 @@
FROM alpine:3.17.0
FROM alpine:3.17.0 as builder
RUN apk add --no-cache upx
ADD ./bin/Purr-musl /app/Purr-musl
RUN upx /app/Purr-musl -o /app/Purr-musl-upx
FROM scratch
WORKDIR /app
ADD ./views /app/views
ADD ./src /app/src
ADD ./bin/Purr-musl /app/Purr-musl
COPY --from=builder /app/Purr-musl-upx /app/Purr
EXPOSE 3000
ENTRYPOINT ["/app/Purr-musl"]
ENTRYPOINT ["/app/Purr"]