Skip to content

Instantly share code, notes, and snippets.

@seocam
Last active August 11, 2021 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seocam/39e4084262558590ff2f59463529d50a to your computer and use it in GitHub Desktop.
Save seocam/39e4084262558590ff2f59463529d50a to your computer and use it in GitHub Desktop.
Dockerfile using distroless with gosu
FROM debian as build
WORKDIR /build/
RUN set -eux; \
apt-get update && \
apt-get install -yq wget gpg && \
wget https://github.com/tianon/gosu/releases/download/1.13/gosu-amd64 -O gosu && \
wget https://github.com/tianon/gosu/releases/download/1.13/gosu-amd64.asc -O gosu.asc && \
gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 && \
gpg --batch --verify gosu.asc gosu && \
chmod +x gosu
# ---
FROM gcr.io/distroless/python3-debian10
COPY --from=build /build/gosu /usr/bin/
ENTRYPOINT ["gosu", "888:888", "python", "-c", "import os; print(os.getuid(), os.getgid())"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment