Skip to content

Commit

Permalink
Allow specifying a commit hash for the UPX version to use.
Browse files Browse the repository at this point in the history
  • Loading branch information
jlesage committed Feb 7, 2025
1 parent 8c5b3de commit 650e864
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,20 @@ FROM --platform=$BUILDPLATFORM tonistiigi/xx AS xx
# Get UPX (statically linked).
FROM --platform=$BUILDPLATFORM alpine:3.20 AS upx
ARG UPX_VERSION=4.2.4
RUN apk --no-cache add curl && \
mkdir /tmp/upx && \
curl -# -L https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-amd64_linux.tar.xz | tar xJ --strip 1 -C /tmp/upx && \
cp -v /tmp/upx/upx /usr/bin/upx
RUN \
if echo "${UPX_VERSION}" | grep -q '^[0-9]\+\.[0-9]\+\.[0-9]\+$'; then \
apk --no-cache add curl && \
mkdir /tmp/upx && \
curl -# -L https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-amd64_linux.tar.xz | tar xJ --strip 1 -C /tmp/upx && \
cp -v /tmp/upx/upx /usr/bin/upx; \
else \
apk --no-cache add build-base cmake clang git && \
git clone https://github.com/upx/upx.git && \
git -C upx reset --hard ${UPX_VERSION} && \
git -C upx submodule update --init && \
make -C upx build/extra/gcc/all CC="clang" CXX="clang++" CFLAGS="-static" CXXFLAGS="-static" LDFLAGS="-Wl,--strip-all" && \
cp -v upx/build/extra/gcc/release/upx /usr/bin/upx; \
fi

# Build TigerVNC server.
FROM --platform=$BUILDPLATFORM alpine:3.20 AS tigervnc
Expand Down

0 comments on commit 650e864

Please sign in to comment.