From d592b10c877780f5a3844dd9bbb6ac3ffc1a731b Mon Sep 17 00:00:00 2001 From: Valentin Tolmer Date: Wed, 12 Oct 2022 15:53:07 +0200 Subject: [PATCH] docker: install gosu --- Dockerfile | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Dockerfile b/Dockerfile index ddac97f..4f47245 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,6 +43,36 @@ RUN cargo build --release -p lldap -p migration-tool \ # Final image FROM alpine:3.14 +ENV GOSU_VERSION 1.14 +# Fetch gosu from git +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 --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \ + gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \ + command -v gpgconf && gpgconf --kill all || :; \ + rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \ + \ +# clean up fetch dependencies + apk del --no-network .gosu-deps; \ + \ + chmod +x /usr/local/bin/gosu; \ +# verify that the binary works + gosu --version; \ + gosu nobody true + + WORKDIR /app COPY --from=builder /app/app/index_local.html app/index.html