-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
37 lines (25 loc) · 919 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
# ---------- Requirements ----------
FROM python:3.10-slim as requirements-stage
WORKDIR /tmp
RUN pip install poetry
COPY ./pyproject.toml ./poetry.lock* /tmp/
RUN poetry export -f requirements.txt --output requirements.txt --without-hashes
# ---------- Release ----------
FROM python:3.10-slim
# keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE 1
# turns off buffering for easier container logging
ENV PYTHONUNBUFFERED 1
# set work directory
WORKDIR /code
# install dependencies
COPY --from=requirements-stage /tmp/requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
# copy project
COPY ./app /code/app
# copy logging config
COPY ./logging.conf /code/logging.conf
# copy migration
COPY ./alembic.ini /code/alembic.ini
COPY ./alembic /code/alembic
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]