Skip to content

Instantly share code, notes, and snippets.

@theoparis
Last active November 18, 2020 22:26
Show Gist options
  • Save theoparis/2d1ded4774380d50c06ec3cc29fe4a9e to your computer and use it in GitHub Desktop.
Save theoparis/2d1ded4774380d50c06ec3cc29fe4a9e to your computer and use it in GitHub Desktop.
python3 docker w/ poetry
FROM python:3.9-alpine
RUN mkdir /app
WORKDIR /app
RUN pip install poetry poethepoet
RUN poetry config settings.virtualenvs.create false
COPY poetry.lock pyproject.toml README.md /app/
# to prevent poetry from installing my actual app,
# and keep docker able to cache layers
RUN mkdir -p /app/src/app
RUN touch /app/src/app/__init__.py
RUN poetry install -n
# now actually copy the real contents of my app
COPY app /app/src/app
EXPOSE 8000
CMD ["poe", "start"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment