Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
FROM alpine as buildroot
MAINTAINER zaggash
# install packages
RUN \
apk add --no-cache \
bash \
curl \
tzdata \
xz
# fetch builder script from gilderlabs
RUN \
curl -s -o \
/mkimage-alpine.bash -L \
https://raw.githubusercontent.com/gliderlabs/docker-alpine/master/builder/scripts/mkimage-alpine.bash && \
chmod +x \
/mkimage-alpine.bash && \
# run the builder
/mkimage-alpine.bash -b -t UTC -r v3.8 -p alpine-baselayout,busybox,alpine-keys,apk-tools,libc-utils,xz -a x86_64 && \
mkdir /buildroot && \
tar -xvJf rootfs.tar.xz -C /buildroot
FROM scratch
MAINTAINER zaggash
COPY --from=buildroot /buildroot /
# set version for s6 overlay
ARG OVERLAY_VERSION="v1.21.4.0"
ARG OVERLAY_ARCH="amd64"
# environment variables
ENV PS1="$(whoami)@$(hostname):$(pwd)$ " \
HOME="/root" \
TERM="xterm"
RUN \
echo "**** install build packages ****" && \
apk add --no-cache --virtual=build-dependencies \
curl \
tar && \
echo "**** install runtime packages ****" && \
apk add --no-cache \
bash \
ca-certificates \
coreutils \
shadow \
tzdata && \
echo "**** add s6 overlay ****" && \
curl -o \
/tmp/s6-overlay.tar.gz -L \
"https://github.com/just-containers/s6-overlay/releases/download/${OVERLAY_VERSION}/s6-overlay-${OVERLAY_ARCH}.tar.gz" && \
tar xfz \
/tmp/s6-overlay.tar.gz -C / && \
echo "**** cleanup ****" && \
apk del --purge \
build-dependencies && \
rm -rf \
/tmp/*
ENTRYPOINT ["/init"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment