mirror of
https://github.com/zadam/trilium.git
synced 2026-09-14 11:06:04 +05:00
43 lines
1.4 KiB
Docker
43 lines
1.4 KiB
Docker
# See the comment in Dockerfile: better-sqlite3 v13 ships N-API prebuilds — the
|
|
# linuxmusl-* ones here — so there is no native compile step and no builder
|
|
# stage. They link libstdc++, which node:*-alpine already provides at runtime.
|
|
FROM node:24.21.0-alpine
|
|
# Create a non-root user with configurable UID/GID
|
|
ARG USER=trilium
|
|
ARG UID=1001
|
|
ARG GID=1001
|
|
ENV USER=${USER}
|
|
ENV UID=${UID}
|
|
ENV GID=${GID}
|
|
|
|
# Install runtime dependencies and create user with specific UID/GID
|
|
RUN apk add --no-cache dumb-init curl && \
|
|
apk add --no-cache bash && \
|
|
# Alpine uses addgroup/adduser (from busybox) instead of groupadd/useradd
|
|
addgroup -g ${GID} ${USER} && \
|
|
adduser -u ${UID} -G ${USER} -s /bin/sh -D -h /home/${USER} ${USER}
|
|
|
|
WORKDIR /home/${USER}/app
|
|
COPY ./dist /home/${USER}/app
|
|
# Also copy the rootless entrypoint script
|
|
COPY rootless-entrypoint.sh /home/${USER}/app/
|
|
RUN chown -R ${USER}:${USER} /home/${USER}
|
|
|
|
# Configure container
|
|
USER ${USER}
|
|
EXPOSE 8080
|
|
|
|
# By default, use UID/GID that was set during build
|
|
# These can be overridden at runtime
|
|
ENV TRILIUM_UID=${UID}
|
|
ENV TRILIUM_GID=${GID}
|
|
ENV TRILIUM_DATA_DIR=/home/${USER}/trilium-data
|
|
|
|
# Use dumb-init as entrypoint to handle signals properly
|
|
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
|
|
|
# Use the entrypoint script
|
|
CMD [ "bash", "./rootless-entrypoint.sh" ]
|
|
|
|
HEALTHCHECK --interval=60s --timeout=5s --start-period=30s CMD sh /home/${USER}/app/docker_healthcheck.sh
|