-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
35 lines (24 loc) · 986 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
FROM python:3.12.6-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 \
&& rm -rf /root/.cache
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 gunicorn app.main:init_app --timeout 30 --workers 1 --worker-class aiohttp.GunicornWebWorker --bind 0.0.0.0:8080 --log-file -
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 -
FROM base as migration
COPY alembic.ini ./
COPY alembic ./alembic
CMD alembic upgrade head && sleep 600