-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
55 lines (42 loc) · 1.55 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
FROM docker.io/amd64/python:3.10 as builder
COPY ./src /usr/local/src/app/src
COPY ./MANIFEST.in /usr/local/src/app/
COPY ./pyproject.toml /usr/local/src/app/
COPY ./README.md /usr/local/src/app/
COPY ./setup.cfg /usr/local/src/app/
COPY ./VERSION /usr/local/src/app/
ARG ADDITIONAL_PIP_PACKAGES
RUN python3 -m pip install --upgrade pip \
&& pip3 --no-cache-dir install \
'build' \
'cryptography' \
'gunicorn' \
${ADDITIONAL_PIP_PACKAGES} \
&& cd /usr/local/src/app/ \
&& python3 -m build
FROM docker.io/amd64/python:3.10-slim
ARG IMAGE_VERSION
LABEL vendor='Testruction.io' \
io.testruction.version="${IMAGE_VERSION}" \
io.testruction.related-product='mvc-flask-dash' \
io.testruction.description='MVC based Flask application including Dash components' \
io.testruction.team="Testructers"
COPY --from=builder /usr/local/src/app/dist/*.tar.gz /tmp/
# Create the internal user
ENV OCI_USER_ID='10001' \
OCI_USER='sysops'
RUN groupadd --gid "${OCI_USER_ID}" "${OCI_USER}" \
&& useradd --system --uid "${OCI_USER_ID}" --gid "${OCI_USER}" "${OCI_USER}" \
&& python3 -m pip install --upgrade pip \
&& pip3 --no-cache-dir install $(ls /tmp/*.tar.gz)
COPY scripts/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh \
&& mkdir -vp /entrypoint.d/ \
&& chmod -R +x /entrypoint.d/
ENTRYPOINT [ "/entrypoint.sh" ]
# Activation de l'utilisateur intégré
USER ${OCI_USER}
WORKDIR ${HOME}/
COPY ./src/wsgi.py ${HOME}/wsgi.py
EXPOSE 5000
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "wsgi:app"]