Skip to content

Commit 7d7b8b7

Browse files
committed
update dockerfile
1 parent a8c969b commit 7d7b8b7

File tree

6 files changed

+212
-431
lines changed

6 files changed

+212
-431
lines changed

Dockerfile

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
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/
2424
RUN uv venv /opt/invenio/.venv
2525

2626
# Use the virtual environment automatically
@@ -64,13 +64,9 @@ COPY templates ${INVENIO_INSTANCE_PATH}/templates
6464
COPY app_data ${INVENIO_INSTANCE_PATH}/app_data
6565
COPY 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
7470
COPY ./package.json ${INVENIO_INSTANCE_PATH}/assets/
7571
COPY ./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

124121
ENV 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-
130124
ENV 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
136130
ENV 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.)
142134
COPY --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
152144
COPY --chown=1654:0 ./Caddyfile /etc/caddy/Caddyfile
153145
COPY --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
156148
VOLUME ["/opt/invenio/var/instance/data", "/opt/invenio/var/instance/archive"]
157149

158150
WORKDIR ${WORKING_DIR}/src
159151

152+
USER invenio
160153
EXPOSE 5000
161-
ENTRYPOINT ["python3", "/opt/invenio/var/instance/entrypoint.py"]
154+
ENTRYPOINT ["python3", "/opt/invenio/var/instance/entrypoint.sh"]
162155
CMD ["gunicorn", "invenio_app.wsgi:application", "--bind", "0.0.0.0:5000", "--workers", "2", "--threads", "2", "--access-logfile", "-", "--error-logfile", "-", "--log-level", "ERROR"]

docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ x-common-env:
6262
# Admin user
6363
INVENIO_ADMIN_EMAIL: ${INVENIO_ADMIN_EMAIL:-info@example.org}
6464
INVENIO_ADMIN_PASSWORD: ${INVENIO_ADMIN_PASSWORD:-changeme}
65-
INVENIO_DEMO_DATA: ${INVENIO_DEMO_DATA:-False}
6665

6766
services:
6867
proxy:

0 commit comments

Comments
 (0)