generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
60 lines (47 loc) · 2.11 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
FROM public.ecr.aws/ubuntu/ubuntu@sha256:5b2fc4131b3c134a019c3ea815811de70e6ad9ee1626f59bf302558a95b436e5
LABEL org.opencontainers.image.vendor="Ministry of Justice" \
org.opencontainers.image.authors="Analytical Platform (analytical-platform@digital.justice.gov.uk)" \
org.opencontainers.image.title="MLflow" \
org.opencontainers.image.description="MLflow image for Analytical Platform" \
org.opencontainers.image.url="https://github.com/ministryofjustice/analytical-platform-mlflow"
ENV CONTAINER_USER="analyticalplatform" \
CONTAINER_UID="1000" \
CONTAINER_GROUP="analyticalplatform" \
CONTAINER_GID="1000" \
DEBIAN_FRONTEND="noninteractive" \
MLFLOW_ROOT="/opt/mlflow"
SHELL ["/bin/bash", "-e", "-u", "-o", "pipefail", "-c"]
RUN <<EOF
userdel --remove --force ubuntu
groupadd \
--gid ${CONTAINER_GID} \
${CONTAINER_GROUP}
useradd \
--uid ${CONTAINER_UID} \
--gid ${CONTAINER_GROUP} \
--create-home \
--shell /bin/bash \
${CONTAINER_USER}
apt-get update --yes
apt-get install --no-install-recommends --yes \
"ca-certificates=20240203" \
"curl=8.5.0-2ubuntu10.5" \
"libpq-dev=16.4-0ubuntu0.24.04.2" \
"python3.12=3.12.3-1ubuntu0.3" \
"python3-pip=24.0+dfsg-1ubuntu1"
apt-get clean --yes
rm --force --recursive /var/lib/apt/lists/*
install --directory --owner ${CONTAINER_USER} --group ${CONTAINER_GROUP} --mode 0755 ${MLFLOW_ROOT}
EOF
COPY --chown=${CONTAINER_USER}:${CONTAINER_GROUP} src${MLFLOW_ROOT}/requirements.txt ${MLFLOW_ROOT}/requirements.txt
RUN <<EOF
pip install --break-system-packages --no-cache-dir --requirement ${MLFLOW_ROOT}/requirements.txt
EOF
USER ${CONTAINER_USER}
WORKDIR ${MLFLOW_ROOT}
EXPOSE 5000
COPY --chown=${CONTAINER_USER}:${CONTAINER_GROUP} src${MLFLOW_ROOT}/auth.ini ${MLFLOW_ROOT}/auth.ini
COPY --chown=nobody:nobody --chmod=0755 src/usr/local/bin/entrypoint.sh /usr/local/bin/entrypoint.sh
COPY --chown=nobody:nobody --chmod=0755 src/usr/local/bin/healthcheck.sh /usr/local/bin/healthcheck.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
HEALTHCHECK --interval=15s --timeout=10s --start-period=10s --retries=3 CMD ["/usr/local/bin/healthcheck.sh"]