busybox/Dockerfile

58 lines
1.8 KiB
Docker
Raw Normal View History

2017-05-11 21:15:10 +00:00
FROM debian:jessie-slim as builder
2017-05-10 20:55:40 +00:00
2017-05-11 21:15:10 +00:00
ARG ARCH=x86_64
ARG PACKAGES="core/glibc"
2017-05-11 21:15:10 +00:00
ARG DEBIAN_FRONTEND=noninteractive
2017-05-10 20:55:40 +00:00
2017-05-12 00:30:49 +00:00
ARG BUSYB_VER=1.26.2
ARG SU_EXEC_VER=v0.2
ARG TINI_VER=v0.14.0
2017-05-11 21:15:10 +00:00
WORKDIR /output
2017-05-11 09:36:22 +00:00
#Set up our dependencies, configure the output filesystem a bit
2017-05-11 21:15:10 +00:00
RUN apt-get update -qy && \
apt-get install -qy curl build-essential && \
mkdir -p usr/bin usr/lib dev proc root etc && \
2017-05-11 21:15:10 +00:00
ln -sv usr/bin bin && \
ln -sv usr/bin sbin && \
ln -sv usr/lib lib && \
ln -sv lib lib64
# Removing this :P
RUN for pkg in $PACKAGES; do \
2017-05-11 21:15:10 +00:00
repo=$(echo $pkg | cut -d/ -f1); \
name=$(echo $pkg | cut -d/ -f2); \
curl -L https://archlinux.org/packages/$repo/$ARCH/$name/download \
| tar xJ -C . ; \
2017-05-11 23:34:57 +00:00
done && \
2017-05-11 21:15:10 +00:00
rm -f .BUILDINFO .INSTALL .PKGINFO .MTREE && \
rm -rf usr/share usr/include lib/*.a lib/*.o lib/gconv \
bin/ldconfig bin/sln bin/localedef bin/nscd
2017-05-12 00:30:49 +00:00
# Pull busybox and some other utilities
RUN curl -L https://busybox.net/downloads/binaries/$BUSYB_VER-defconfig-multiarch/busybox-$ARCH > /output/usr/bin/busybox && \
curl -L https://github.com/javabean/su-exec/releases/download/${SU_EXEC_VER}/su-exec.amd64 > /output/bin/su-exec && \
curl -L https://github.com/krallin/tini/releases/download/${TINI_VER}/tini-amd64 > /output/bin/tini && \
chmod +x /output/bin/busybox /output/bin/su-exec /output/bin/tini
2017-05-11 23:34:57 +00:00
2017-05-10 20:55:40 +00:00
WORKDIR /tmp
2017-05-11 21:15:10 +00:00
# Build and install openssl
ARG DESTDIR=/output/libressl
2017-05-11 21:15:10 +00:00
RUN curl -L https://www.openssl.org/source/openssl-1.1.0e.tar.gz | \
tar xz -C /tmp --strip-components=1 && \
./config --prefix=/output && \
make install_sw && \
rm /output/lib/*.a && \
rm -r /output/include
# =============
FROM scratch
2017-05-10 20:55:40 +00:00
WORKDIR /
2017-05-11 23:34:57 +00:00
COPY --from=builder /output/ /
# Needed cos we dont have /bin/sh yet
RUN ["/bin/busybox", "--install", "-s", "/bin"]
2017-05-11 21:15:10 +00:00
CMD ["sh"]