Merge pull request #46 from kscherer/musl
Reduce binary size using musl
This commit is contained in:
commit
e862d69a26
3 changed files with 19 additions and 4 deletions
|
@ -3,8 +3,8 @@ FROM debian:jessie
|
||||||
MAINTAINER Chris Kuehl <ckuehl@yelp.com>
|
MAINTAINER Chris Kuehl <ckuehl@yelp.com>
|
||||||
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
|
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
build-essential devscripts equivs && \
|
build-essential devscripts equivs musl-tools python python-pytest python-mock && \
|
||||||
apt-get clean
|
rm -rf /var/lib/apt/lists/* && apt-get clean
|
||||||
WORKDIR /mnt
|
WORKDIR /mnt
|
||||||
|
|
||||||
ENTRYPOINT mk-build-deps -i --tool 'apt-get --no-install-recommends -y' && make builddeb
|
ENTRYPOINT mk-build-deps -i --tool 'apt-get --no-install-recommends -y' && make builddeb
|
||||||
|
|
4
Makefile
4
Makefile
|
@ -1,4 +1,4 @@
|
||||||
CFLAGS=-std=gnu99 -static -Wall -Werror -O3
|
CFLAGS=-std=gnu99 -static -s -Wall -Werror -O3
|
||||||
|
|
||||||
TEST_PACKAGE_DEPS := python python-pip
|
TEST_PACKAGE_DEPS := python python-pip
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ clean-tox:
|
||||||
|
|
||||||
.PHONY: builddeb
|
.PHONY: builddeb
|
||||||
builddeb:
|
builddeb:
|
||||||
debuild -us -uc -b
|
debuild --set-envvar=CC=musl-gcc -us -uc -b
|
||||||
rm -rf dist && mkdir dist
|
rm -rf dist && mkdir dist
|
||||||
mv ../dumb-init_*.deb dist/
|
mv ../dumb-init_*.deb dist/
|
||||||
|
|
||||||
|
|
15
README.md
15
README.md
|
@ -155,6 +155,21 @@ Running this same command without `dumb-init` would result in being unable to
|
||||||
stop the container without `SIGKILL`, but with `dumb-init`, you can send it
|
stop the container without `SIGKILL`, but with `dumb-init`, you can send it
|
||||||
more humane signals like `SIGTERM`.
|
more humane signals like `SIGTERM`.
|
||||||
|
|
||||||
|
## Building dumb-init
|
||||||
|
|
||||||
|
Build requires a working compiler and libc headers and defaults to glibc.
|
||||||
|
|
||||||
|
$ make
|
||||||
|
|
||||||
|
### Musl
|
||||||
|
|
||||||
|
Statically compiled dumb-init is over 700KB due to glibc, but musl is
|
||||||
|
now an option. On Debian/Ubuntu `apt-get install musl-tools` to
|
||||||
|
install the source and wrappers.
|
||||||
|
|
||||||
|
$ CC=musl-gcc make
|
||||||
|
|
||||||
|
When statically compiled with musl the binary size is around 20KB.
|
||||||
|
|
||||||
## See also
|
## See also
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue