Created
February 27, 2021 15:58
-
-
Save KYDronePilot/a97b769dc83bb05c49dbec6b59f5faa0 to your computer and use it in GitHub Desktop.
Pipenv Dockerfile template
This file contains 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
FROM python:3-alpine AS base | |
WORKDIR /project | |
ENV PIPENV_VENV_IN_PROJECT=1 | |
RUN pip install --no-cache-dir pipenv | |
COPY ./Pipfile* ./ | |
# Install/build pipenv environment in separate container to reduce bulk | |
FROM base AS pipenv_builder | |
RUN apk add --no-cache \ | |
# <place any packages needed for building PIP deps here> | |
&& pipenv sync | |
# Final image | |
FROM base | |
ENV PYTHONPATH=/project/src | |
# Install lightweight versions of build packages with just the shared | |
# libraries needed | |
#RUN apk add --no-cache ... | |
# Copy over the pipenv environment | |
COPY --from=pipenv_builder /project/.venv ./.venv | |
# Copy main project files | |
COPY ./src /project/src/ | |
CMD [ "pipenv", "run", "some-startup-task" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment