-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (20 loc) · 700 Bytes
/
Copy pathDockerfile
File metadata and controls
33 lines (20 loc) · 700 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Based on:
# https://medium.com/@albertazzir/blazing-fast-python-docker-builds-with-poetry-a78a66f5aed0
FROM python:3.11-buster as build
RUN pip install poetry==1.6.1
ENV POETRY_NO_INTERACTION=1
ENV POETRY_VIRTUALENVS_IN_PROJECT=1
ENV POETRY_VIRTUALENVS_CREATE=1
ENV POETRY_CACHE_DIR='/tmp/poetry_cache'
WORKDIR /app
COPY poetry.lock pyproject.toml README.md ./
RUN poetry install --no-root --without dev && rm -rf $POETRY_CACHE_DIR
FROM python:3.11-slim-buster as runtime
ENV VIRTUAL_ENV=/app/.venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
ENV PYTHONUNBUFFERED=1
COPY --from=build $VIRTUAL_ENV $VIRTUAL_ENV
COPY pybetter pybetter
WORKDIR /src
ADD . .
ENTRYPOINT ["python3", "-m", "pybetter"]