-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 50af1d7
Showing
4 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM lalyos/scratch-chmx | ||
|
||
ADD release/upx /bin/upx | ||
RUN ["/bin/chmx", "/bin/upx"] | ||
|
||
VOLUME /data | ||
WORKDIR /data | ||
|
||
ENTRYPOINT ["/bin/upx"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
VERSION=3.91 | ||
|
||
build: | ||
rm -rf release | ||
docker build -t upx-bin build | ||
docker run --rm -v $(shell pwd)/release:/release upx | ||
docker build -t lalyos/upx . | ||
|
||
deps: | ||
go get github.com/progrium/gh-release | ||
|
||
release: build | ||
gh-release create lalyos/docker-upx $(VERSION) | ||
|
||
.PHONY: build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Go small or go home | ||
|
||
Lets save the interweb, and make all binaries small. This tiny () Docker image | ||
is a containerized [upx](http://upx.sourceforge.net). | ||
|
||
## Usage | ||
|
||
|
||
You can compress your binary file as: | ||
|
||
``` | ||
docker run -v $PWD:/release lalyos/upx mybinary | ||
``` | ||
|
||
## | ||
|
||
|
||
## tl;dr | ||
|
||
- It is statically built with Alpine linux | ||
- compressed by itdelf (eat your own dogfood) | ||
- added into a [custom scratch](https://github.com/lalyos/docker-scratch-chmx) | ||
|
||
## TODO | ||
|
||
If I’m getting too bored (unlikely in the coming weeks) i might create an | ||
ordinary Alpine package for upx. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
FROM lalyos/alpine-build:edge | ||
|
||
RUN apk add -U zlib-dev xz-dev curl perl | ||
|
||
ENV LDFLAGS=-static | ||
|
||
ENV UCL_VER 1.03 | ||
RUN curl -L http://www.oberhumer.com/opensource/ucl/download/ucl-${UCL_VER}.tar.gz|tar -xzv \ | ||
&& cd ucl-${UCL_VER} \ | ||
&& ./configure \ | ||
&& make \ | ||
&& make install | ||
|
||
ENV LZMA_VER 920 | ||
RUN curl -LO http://www.7-zip.org/a/lzma${LZMA_VER}.tar.bz2 \ | ||
&& bunzip2 lzma${LZMA_VER}.tar.bz2 \ | ||
&& tar -xvf lzma${LZMA_VER}.tar | ||
ENV UPX_LZMADIR / | ||
|
||
VOLUME /release | ||
|
||
ENV UPX_UCLDIR=/ucl-${UCL_VER} | ||
ENV UPX_VER 3.91 | ||
RUN curl -LO http://upx.sourceforge.net/download/upx-${UPX_VER}-src.tar.bz2 \ | ||
&& bunzip2 upx-${UPX_VER}-src.tar.bz2 \ | ||
&& tar -xvf upx-${UPX_VER}-src.tar \ | ||
&& cd upx-${UPX_VER}-src \ | ||
&& sed -i "/addLoad/ s/NULL/(char*)NULL/" src/packer.cpp \ | ||
&& make all | ||
|
||
# packs itself | ||
CMD /upx-${UPX_VER}-src/src/upx.out --best --ultra-brute -o/release/upx /upx-${UPX_VER}-src/src/upx.out | ||
|
||
|
||
|