Created
February 12, 2021 13:50
-
-
Save unfor19/7968c62074ff1f1f2924ae4766cecaed to your computer and use it in GitHub Desktop.
multi-stage-build-good-dockerfile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# GOOD | |
FROM python:3.9.1-slim as build | |
# Upgrade pip and then install build tools | |
RUN pip install --upgrade pip && \ | |
pip install --upgrade wheel setuptools wheel check-wheel-contents | |
### Consider the comments as commands | |
# Copy and install requirements - better caching | |
# Copy the application from Docker build context to WORKDIR | |
# Build the application, validate wheel contents and install the application | |
FROM python:3.9.1-slim as app | |
WORKDIR /myapp/ | |
COPY --from=build /dist/ /myapp/ | |
ENTRYPOINT ["app"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment