Dockerized static UPX which allows easy copy and usage of UPX. Since the arm64 builds of UPX seem non existing for Alpine I needed this :)
Run it directly on a mapped volume
docker run --rm -v "$PWD/foo:/foo" lansible/upx --ultra-brute -o /foo/bar.upx /foo/bar
Use it to minify binaries in a multistage Docker build
FROM your/baseimage
COPY --from=lansible/upx /usr/bin/upx /usr/bin/upx
RUN upx --ultra-brute --ultra-brute --best -o /foo/bar.upx /foo/bar
Run the image without a command to see the UPX help
docker run --rm lansible/upx
For more information about UPX see upx/upx and their documentation
The image accepts a build-arg that sets the UPX version to build. This arg gets passed to git clone --branch <arg>
, so everything --branch supports will work (branches & tags)
Also it uses the multiarch/alpine image for easy QEMU emulation. To be able to cross-compile register the binaries first:
docker run --rm --privileged multiarch/qemu-user-static:register --reset
Then pass the ARCHITECTURE
build-arg to cross-compile for arm64 for example.
docker build . -t upx:devel --build-arg VERSION=devel --build-arg ARCHITECTURE=amd64