-
Notifications
You must be signed in to change notification settings - Fork 8
/
Dockerfile
31 lines (25 loc) · 1020 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
FROM bmltenabled/uvicorn-gunicorn-fastapi:python3.9-slim
# improve logging performance (don't buffer messages to output)
ENV PYTHONUNBUFFERED=1
# reduce images size
ENV PYTHONDONTWRITEBYTECODE=1
# next two environment files ensure UTF-8 processing works consistently
ENV PYTHONIOENCODING='utf-8'
ENV LANG='C.UTF-8'
# install Poetry
# also disable virtual environment creation so global installs (like gunicorn)
# can actually see packages
RUN pip3 install --disable-pip-version-check --no-cache-dir wheel \
&& pip3 install --disable-pip-version-check --no-cache-dir poetry crcmod \
&& poetry config virtualenvs.create false
ENV MODULE_NAME=api.main
WORKDIR /app
COPY pyproject.toml /app/
COPY poetry.lock /app/
# the extra delete steps here probably aren't needed, but good to have available
RUN poetry install --no-root --only main \
&& rm -r /root/.cache/pypoetry/cache /root/.cache/pypoetry/artifacts/ \
&& apt-get autoremove -yqq \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY . /app