Created
October 12, 2022 07:05
-
-
Save melvinkcx/b5ff38c17f67bd54844c2036950a0106 to your computer and use it in GitHub Desktop.
Multi-stage Python image with Poetry as deps manager
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.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