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

This commit is contained in:
perf3ct 2025-05-22 12:49:38 -07:00
parent 436fc4c943
commit 093cd5c53f
2 changed files with 6 additions and 8 deletions

View File

@ -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"]

View File

@ -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"]