Skip to content

Instantly share code, notes, and snippets.

@germainlefebvre4
Created April 9, 2020 22:45
Show Gist options
  • Save germainlefebvre4/74ee635ff54e4e5aad5acc32d7986c99 to your computer and use it in GitHub Desktop.
Save germainlefebvre4/74ee635ff54e4e5aad5acc32d7986c99 to your computer and use it in GitHub Desktop.
Build docker image for python app based on pipenv development
FROM python:3.8-alpine AS base
FROM base as builder
RUN apk update && \
apk add py-pip && \
pip install pipenv
# Update pipenv libs
COPY Pipfile* ./
RUN PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy
FROM base as runner
# Python libs and sources
COPY --from=builder /.venv/lib/python3.8/site-packages /usr/local/lib/python3.8/site-packages
COPY main.py .
CMD ["python", "main.py"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment