Skip to content

Instantly share code, notes, and snippets.

@starlightromero
Created July 19, 2021 22:58
Show Gist options
  • Save starlightromero/b0c64430e1ce8c7448dc5410dbc11ef5 to your computer and use it in GitHub Desktop.
Save starlightromero/b0c64430e1ce8c7448dc5410dbc11ef5 to your computer and use it in GitHub Desktop.
Python Dockerfile.distroless
FROM python:3.9-buster as build
WORKDIR /usr/src/app
RUN apt-get -qq update && \
apt-get -qqy --no-install-recommends install binutils=2.31.1-16
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip==21.1.2 && \
pip install --no-cache-dir -r requirements.txt && \
pip install --no-cache-dir pyinstaller==4.3
COPY . .
RUN pyinstaller app.py
FROM gcr.io/distroless/python3:nonroot
WORKDIR /usr/src/app
COPY --from=build /usr/src/app/dist ./dist
ENTRYPOINT [ "dist/app/app" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment