Stackers,
I'm using Docker to containerize my app. In the stage below, I'm trying to pack it using UPX.
FROM alpine:3.8 AS compressor
# Version of upx to be used(without the 'v' prefix)
# For all releases, see https://github.com/upx/upx/releases
ARG UPX_VERSION=3.94
# Fetch upx, decompress it, make it executable.
ADD https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-amd64_linux.tar.xz /tmp/upx.tar.xy
RUN tar -xJOf /tmp/upx.tar.xy upx-${UPX_VERSION}-amd64_linux/upx > /usr/local/bin/upx \
&& chmod +x /usr/local/bin/upx
COPY --from=builder /usr/local/bin/ace /usr/local/bin/ace
RUN /usr/local/bin/upx --overlay=strip --best /usr/local/bin/ace
The thing is when I build the image I get the following error:
The command '/bin/sh -c /usr/local/bin/upx --overlay=strip --best /usr/local/bin/ace' returned a non-zero code: 127
For some reason, the container doesn't recognize upx as executable! Can anyone give me some pointers?
Turns out there is an apk package for UPX. The easier way to install is:
apk add upx