Skip to content

Build your personal knowledge base with Trilium Notes

fix(docker): fix when we copy and chmod the entrypoint for rootless images

perf3ct093cd5c53fec
diff --git a/apps/server/Dockerfile.alpine.rootless b/apps/server/Dockerfile.alpine.rootless
index 11946e78b8..e161e54735 100644
--- a/apps/server/Dockerfile.alpine.rootless
+++ b/apps/server/Dockerfile.alpine.rootless
@@ -24,6 +24,9 @@ RUN apk add --no-cache dumb-init && \
WORKDIR /home/${USER}/app
COPY ./dist /home/${USER}/app
+# Also copy the rootless entrypoint script
+COPY rootless-entrypoint.sh /home/${USER}/app/
+RUN chmod +x /home/${USER}/app/rootless-entrypoint.sh
RUN rm -rf /home/${USER}/app/node_modules/better-sqlite3
COPY --from=builder /usr/src/app/node_modules/better-sqlite3 /home/${USER}/app/node_modules/better-sqlite3
RUN chown -R ${USER}:${USER} /home/${USER}
@@ -41,10 +44,6 @@ ENV TRILIUM_DATA_DIR=/home/${USER}/trilium-data
# Use dumb-init as entrypoint to handle signals properly
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
-# Copy the entrypoint script
-COPY rootless-entrypoint.sh /home/${USER}/app/
-RUN chmod +x /home/${USER}/app/rootless-entrypoint.sh
-
# Use the entrypoint script
CMD ["/home/${USER}/app/rootless-entrypoint.sh"]
diff --git a/apps/server/Dockerfile.rootless b/apps/server/Dockerfile.rootless
index 950ccee469..a08f648c04 100644
--- a/apps/server/Dockerfile.rootless
+++ b/apps/server/Dockerfile.rootless
@@ -26,6 +26,9 @@ RUN rm -rf \
WORKDIR /home/${USER}/app
COPY ./dist /home/${USER}/app
+# Also copy the rootless entrypoint script
+COPY rootless-entrypoint.sh /home/${USER}/app/
+RUN chmod +x /home/${USER}/app/rootless-entrypoint.sh
RUN rm -rf /home/${USER}/app/node_modules/better-sqlite3
COPY --from=builder /usr/src/app/node_modules/better-sqlite3 /home/${USER}/app/node_modules/better-sqlite3
RUN chown -R ${USER}:${USER} /home/${USER}
@@ -40,10 +43,6 @@ ENV TRILIUM_UID=${UID}
ENV TRILIUM_GID=${GID}
ENV TRILIUM_DATA_DIR=/home/${USER}/trilium-data
-# Copy the entrypoint script
-COPY rootless-entrypoint.sh /home/${USER}/app/
-RUN chmod +x /home/${USER}/app/rootless-entrypoint.sh
-
# Use the entrypoint script
CMD ["/home/${USER}/app/rootless-entrypoint.sh"]