-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
28 lines (19 loc) · 804 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
FROM python:3.11.7-slim as base
RUN python -m pip install --upgrade --no-cache-dir pip wheel setuptools \
&& python -m pip install poetry \
&& poetry config virtualenvs.create false \
&& mkdir -p /srv/src
ENV PYTHONPATH=/srv/src
WORKDIR /srv/src
COPY pyproject.toml poetry.lock ./
RUN poetry install --no-cache --only=main \
&& rm -rf /root/.cache
COPY app ./app
FROM base as development
CMD uvicorn --factory app.main:init_app --host 0.0.0.0 --port 8080 --reload
FROM base as test
RUN poetry install --only=test
COPY ../tests ./tests
CMD python -m pytest --cov-report term-missing --cov=app --durations=3 .
FROM base as production
CMD gunicorn "app.main:init_app()" --timeout 120 --workers $(nproc) --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:8080 --log-file -