Skip to content

Instantly share code, notes, and snippets.

@melvinkcx
Created October 12, 2022 07:05
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 melvinkcx/b5ff38c17f67bd54844c2036950a0106 to your computer and use it in GitHub Desktop.
Save melvinkcx/b5ff38c17f67bd54844c2036950a0106 to your computer and use it in GitHub Desktop.
Multi-stage Python image with Poetry as deps manager
FROM python:3.10 AS base
WORKDIR /app
RUN curl -sSL https://install.python-poetry.org | python3 -
COPY ./poetry.lock /app/poetry.lock
COPY ./pyproject.toml /app/pyproject.toml
ENV PATH=/root/.local/bin:$PATH
#Disable venv/poetry shell
RUN poetry config virtualenvs.create false
RUN poetry install
FROM python:3.10-slim AS release
COPY --from=base /usr/local /usr/local
COPY ./ /app
WORKDIR /app
CMD ["python", "main.py"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment