-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
40 lines (26 loc) · 947 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
34
35
36
37
38
39
40
FROM python:3.10-slim as python-base
# SET ENV #
ENV PYTHONBUFFERED=1 \
PIP_NO_CACHE_DIR="off" \
POETRY_VERSION=1.4.0 \
POETRY_HOME="/opt/poetry" \
POETRY_VIRTUALENVS_IN_PROJECT=true \
POETRY_NO_INTERACTION=1 \
PYSETUP_PATH="/app" \
VENV_PATH="/app/.venv"
ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH"
RUN apt-get update && apt-get install pkg-config libxml2-dev libxmlsec1-dev libxmlsec1-openssl gcc -y
FROM python-base as builder-base
RUN apt-get update && apt-get install --no-install-recommends -y curl \
&& curl -sSL https://install.python-poetry.org | python
ARG APP_TO_BUILD
WORKDIR $PYSETUP_PATH
COPY poetry.lock pyproject.toml ./
RUN python -m venv $VENV_PATH
RUN . ${VENV_PATH}/bin/activate
RUN pip install -U pip
RUN poetry install
FROM python-base as production
COPY --from=builder-base $PYSETUP_PATH $PYSETUP_PATH
COPY . $PYSETUP_PATH
CMD cd $PYSETUP_PATH && uvicorn main:app --reload