-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (30 loc) · 1.03 KB
/
Dockerfile
File metadata and controls
46 lines (30 loc) · 1.03 KB
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
FROM python:3.11-slim-bookworm AS installer
WORKDIR /usr/src/app
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Install Git for VCS versioning
RUN apt-get update && \
apt-get install -y --no-install-recommends git && \
rm -rf /var/lib/apt/lists/*
# Generate python dependencies wheels
COPY . .
RUN pip wheel --no-cache-dir --wheel-dir /usr/src/app/wheels .[prod]
FROM python:3.11-slim-bookworm
ARG VERSION=latest
LABEL version=${VERSION}
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
RUN apt-get update && \
apt-get install -y --no-install-recommends mailcap && \
pip install --no-cache-dir --upgrade pip setuptools && \
rm -rf /var/lib/apt/lists/*
COPY resources/gunicorn.conf.py /etc/gunicorn.conf.py
COPY --from=installer /usr/src/app/wheels /wheels
RUN pip install --no-cache-dir /wheels/* && \
rm -rf /wheels
RUN groupadd -g 1000 app && \
useradd -mr -d /home/app -s /bin/bash -u 1000 -g 1000 app
USER app
WORKDIR /home/app
EXPOSE 8000
CMD ["gunicorn", "--config", "/etc/gunicorn.conf.py"]