-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile.api
48 lines (38 loc) · 1.04 KB
/
Dockerfile.api
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
41
42
43
44
45
46
47
48
#
# `python-base` stage
# contains all shared environment variables
#
FROM python:3.9-slim-buster as python-base
ENV \
POETRY_VERSION=1.4.2 \
POETRY_HOME="/opt/poetry" \
POETRY_VIRTUALENVS_IN_PROJECT=true \
POETRY_NO_INTERACTION=1 \
VENV_PATH="/app/.venv"
ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH"
#
# `builder-base` stage
# used to build poetry
#
FROM python-base as builder-base
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
curl
# install poetry
RUN curl -sSL https://install.python-poetry.org | python3 -
#
# `development` stage
# used to create a virtual environment and start server
#
FROM python-base as development
# copy built poetry
COPY --from=builder-base $POETRY_HOME $POETRY_HOME
WORKDIR /app
COPY poetry.lock pyproject.toml poetry.toml .
COPY ./src ./src
COPY exts.py factory.py app.py .
# do not install dev dependencies
RUN poetry install --only main
ENV FLASK_DEBUG=0
EXPOSE 5000
CMD ["gunicorn", "--workers=3", "--threads=3", "-b", ":5000", "app:app", "--timeout 1000"]