Skip to content

Commit

Permalink
inital version
Browse files Browse the repository at this point in the history
  • Loading branch information
lalyos committed May 26, 2015
0 parents commit 50af1d7
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Dockerfile
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"]
15 changes: 15 additions & 0 deletions Makefile
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
27 changes: 27 additions & 0 deletions README.md
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.
35 changes: 35 additions & 0 deletions build/Dockerfile
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



0 comments on commit 50af1d7

Please sign in to comment.