diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..9babce19310374549d92cd523f654fa58cae74ba --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +ARG GOSU_VERSION=1.12 +ARG ALPINE_VERSION=3.12 +FROM alpine:$ALPINE_VERSION as scratch +ARG GOSU_VERSION +ENV GOSU_VERSION=$GOSU_VERSION +RUN set -eux; \ + \ + apk add --no-cache --virtual .gosu-deps \ + ca-certificates \ + dpkg \ + gnupg \ + ; \ + \ + dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \ + wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \ + wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \ + \ +# verify the signature + export GNUPGHOME="$(mktemp -d)"; \ + gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ + gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ + command -v gpgconf && gpgconf --kill all || :; \ + \ + chmod +x /usr/local/bin/gosu; \ +# verify that the binary works + gosu --version; \ + gosu nobody true; + +FROM alpine:$ALPINE_VERSION +ARG GOSU_VERSION +ENV GOSU_VERSION $GOSU_VERSION +COPY --from=scratch /usr/local/bin/gosu /usr/local/bin/ diff --git a/README.md b/README.md index 8f4f34ffc5acb6eef3b0325f20d9f729a126e771..5f68d0495972f921dc58e8d5ba7c722431f3f389 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,19 @@ # Dockerized gosu -> Docker images with gosu installed. +> Alpine Docker image with gosu installed. + +## Usage + +The image is based on the latest Alpine image with just `gosu` installed. If you +wish to use a different image as a base then you can just copy the binary from +this image so: + +``` +FROM adarnimrod/gosu as gosu + +FROM alpine:latest +COPY --from=gosu /usr/local/bin/gosu /usr/local/bin/ +``` ## License