-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (35 loc) · 1.15 KB
/
Dockerfile
File metadata and controls
50 lines (35 loc) · 1.15 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
47
48
49
50
# syntax=docker/dockerfile:1
FROM python:3.12-slim AS builder
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
WORKDIR /app
COPY requirements.txt ./
RUN python -m venv /opt/venv \
&& /opt/venv/bin/pip install --upgrade pip \
&& /opt/venv/bin/pip install --no-cache-dir -r requirements.txt
FROM python:3.12-slim AS runtime
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PATH="/opt/venv/bin:${PATH}"
WORKDIR /app
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
libcairo2 \
libgdk-pixbuf-2.0-0 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libjpeg62-turbo \
libxml2 \
libxslt1.1 \
fonts-liberation \
shared-mime-info \
&& rm -rf /var/lib/apt/lists/* \
&& adduser --disabled-password --gecos "" reconscript
COPY --from=builder /opt/venv /opt/venv
COPY . .
RUN chown -R reconscript:reconscript /app
USER reconscript
EXPOSE 5000
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:5000/healthz', timeout=3)"
CMD ["python", "start.py"]