-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
61 lines (46 loc) · 1.41 KB
/
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
54
55
56
57
58
59
60
61
FROM python:3.12-alpine as builder
RUN apk add --no-cache --update --virtual .build-deps \
build-base \
linux-headers \
ca-certificates \
python3-dev \
&& rm -rf /var/cache/* \
&& mkdir /var/cache/apk \
&& ln -sf /lib/ld-musl-x86_64.so.1 /usr/bin/ldd \
&& ln -s /lib /lib64
WORKDIR /svc
ARG VERSION=1
RUN echo "Version: ${VERSION}"
COPY requirements/* ./
RUN pip install pip wheel --upgrade \
&& pip wheel --wheel-dir=/svc/wheels -r base.txt -r production.txt
FROM python:3.12-alpine
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
DEBUG=0
RUN apk add --no-cache --update \
&& rm -rf /var/cache/* \
&& mkdir /var/cache/apk \
&& ln -sf /lib/ld-musl-x86_64.so.1 /usr/bin/ldd \
&& ln -s /lib /lib64 \
&& ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
&& echo $TZ > /etc/timezone
COPY --from=builder /svc /svc
RUN pip install pip setuptools wheel --upgrade \
&& pip install --no-index --find-links=/svc/wheels -r /svc/base.txt -r /svc/production.txt \
&& addgroup -S flask_user \
&& adduser \
--disabled-password \
--gecos "" \
--ingroup flask_user \
--no-create-home \
-s /bin/false \
flask_user
WORKDIR /app
ARG VERSION=1
RUN echo "Version: ${VERSION}"
COPY . /app/
RUN chown flask_user:flask_user -R /app
USER flask_user
EXPOSE 5000
CMD gunicorn src.lms.app:app --bind 0.0.0.0:5000