-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
33 lines (23 loc) · 889 Bytes
/
Dockerfile
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
ARG PYTHON_TAG
FROM python:${PYTHON_TAG} as base
WORKDIR /workspace
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential libpq-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/downloaded_packages
FROM base as builder
ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache \
PATH="/root/.local/bin:$PATH"
COPY pyproject.toml poetry.lock ./
RUN curl -sSL https://install.python-poetry.org | python3 -\
&& poetry install --no-root \
&& rm -rf $POETRY_CACHE_DIR \
&& curl -sSL https://install.python-poetry.org | python3 - --uninstall
FROM base as runtime
ENV VIRTUAL_ENV=/workspace/.venv \
PATH="/workspace/.venv/bin:$PATH"
COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}