1- FROM dhi.io/python:3.13-debian13-dev AS builder
2- LABEL service="starter"
3- LABEL maintainer="Front Matter <info@front-matter.de>"
1+ FROM python:3.13-bookworm AS builder
2+ # FROM dhi.io/python:3.13-debian13-dev AS builder
43
5- # Dockerfile that builds the InvenioRDM Starter Docker image using DHI
6- # (Docker Hardened Image) for enhanced security
4+ LABEL maintainer="Front Matter <info@front-matter.de>"
75
8- ENV LANG=en_US.UTF-8 \
6+ ENV DEBIAN_FRONTEND=noninteractive \
7+ TZ=Etc/UTC \
8+ LANG=en_US.UTF-8 \
99 LANGUAGE=en_US:en
1010
1111# Install OS package dependencies and Node.js in a single layer
@@ -20,7 +20,7 @@ RUN --mount=type=cache,sharing=locked,target=/var/cache/apt \
2020 npm install -g pnpm@latest-10
2121
2222# Install uv and activate virtualenv
23- COPY --from=ghcr.io/astral-sh/uv:0.9.18 /uv /uvx /bin/
23+ COPY --from=ghcr.io/astral-sh/uv:0.9.26 /uv /uvx /bin/
2424RUN uv venv /opt/invenio/.venv
2525
2626# Use the virtual environment automatically
@@ -64,13 +64,9 @@ COPY templates ${INVENIO_INSTANCE_PATH}/templates
6464COPY app_data ${INVENIO_INSTANCE_PATH}/app_data
6565COPY translations ${INVENIO_INSTANCE_PATH}/translations
6666
67- # from: https://github.com/tu-graz-library/docker-invenio-base
68- # enables the option to have a deterministic javascript dependency build
69- # package.json and pnpm-lock are needed, because otherwise package.json
70- # is newer as pnpm-lock and pnpm-lock would not be used then
71- # do this only if you know what you are doing. forgetting to update those
72- # two files can cause bugs, because of possible missmatches of needed
73- # javascript dependencies
67+
68+ # Enable the option to have a deterministic javascript dependency build
69+ # From: https://github.com/tu-graz-library/docker-invenio-base
7470COPY ./package.json ${INVENIO_INSTANCE_PATH}/assets/
7571COPY ./pnpm-lock.yaml ${INVENIO_INSTANCE_PATH}/assets/
7672
@@ -119,24 +115,20 @@ RUN mkdir -p /invenio-libs && \
119115 cp -P /usr/lib/x86_64-linux-gnu/libicuuc*.so* /invenio-libs/ 2>/dev/null || true && \
120116 cp -P /usr/lib/x86_64-linux-gnu/libicudata*.so* /invenio-libs/ 2>/dev/null || true
121117
122- FROM dhi.io/python:3.13-debian13 AS runtime
118+ FROM python:3.13-slim-bookworm AS runtime
119+ # FROM dhi.io/python:3.13-debian13 AS runtime
123120
124121ENV LANG=en_US.UTF-8 \
125122 LANGUAGE=en_US:en
126123
127- # DHI images are minimal - copy required Cairo libraries from builder
128- # These are needed for cairosvg/cairocffi used by invenio_formatter
129-
130124ENV VIRTUAL_ENV=/opt/invenio/.venv \
131125 PATH="/opt/invenio/.venv/bin:$PATH" \
132126 WORKING_DIR=/opt/invenio \
133127 INVENIO_INSTANCE_PATH=/opt/invenio/var/instance
134128
135- # DHI uses UID 1654 as non-root user - already configured in base image
129+ # create non-root invenio user
136130ENV INVENIO_USER_ID=1654
137-
138- # DHI is shell-less by design for security
139- # entrypoint.py runs initialization in Python (no shell required)
131+ RUN adduser invenio --uid ${INVENIO_USER_ID} --gid 0 --no-create-home --disabled-password
140132
141133# Copy runtime libraries from builder (Cairo for invenio_formatter, etc.)
142134COPY --from=builder /invenio-libs/* /usr/lib/x86_64-linux-gnu/
@@ -152,11 +144,12 @@ COPY --from=builder --chown=1654:0 ${INVENIO_INSTANCE_PATH}/invenio.cfg ${INVENI
152144COPY --chown=1654:0 ./Caddyfile /etc/caddy/Caddyfile
153145COPY --chown=1654:0 --chmod=755 ./entrypoint.py ${INVENIO_INSTANCE_PATH}/entrypoint.py
154146
155- # Declare volumes for persistent data (writable directories managed by DHI)
147+ # Declare volumes for persistent data
156148VOLUME ["/opt/invenio/var/instance/data" , "/opt/invenio/var/instance/archive" ]
157149
158150WORKDIR ${WORKING_DIR}/src
159151
152+ USER invenio
160153EXPOSE 5000
161- ENTRYPOINT ["python3" , "/opt/invenio/var/instance/entrypoint.py " ]
154+ ENTRYPOINT ["python3" , "/opt/invenio/var/instance/entrypoint.sh " ]
162155CMD ["gunicorn" , "invenio_app.wsgi:application" , "--bind" , "0.0.0.0:5000" , "--workers" , "2" , "--threads" , "2" , "--access-logfile" , "-" , "--error-logfile" , "-" , "--log-level" , "ERROR" ]
0 commit comments