-
Notifications
You must be signed in to change notification settings - Fork 11
/
Dockerfile
53 lines (39 loc) · 949 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
FROM python:3.12.4-alpine as builder
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /app
RUN apk update && apk add --no-cache \
git \
curl \
xz \
gcc \
g++ \
zlib-dev \
libffi-dev \
build-base \
cmake \
jpeg-dev
COPY requirements.txt .
RUN --mount=type=cache,target=/root/.cache/pip \
python -m pip install -r requirements.txt --prefix=/install
FROM python:3.12.4-alpine as runtime
ARG UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
appuser
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /app
RUN apk update && apk add --no-cache \
git \
ca-certificates
COPY --from=builder /install /usr/local
COPY . .
RUN chown -R appuser:appuser /app
USER appuser
CMD ["python", "main.py"]