From e69ead23ec31f5e37d1242fc5ef79c9ccebb6215 Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Sat, 29 Aug 2020 22:27:48 +0300 Subject: [PATCH] Just a single latest image based on Alpine. --- Dockerfile | 32 ++++++++++++++++++++++++++++++++ README.md | 15 ++++++++++++++- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9babce1 --- /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 8f4f34f..5f68d04 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 -- GitLab