mirror of
https://github.com/zadam/trilium.git
synced 2025-11-04 20:36:13 +01:00
feat(docker): move from inline script to entrypoint
This commit is contained in:
@@ -41,25 +41,11 @@ ENV TRILIUM_DATA_DIR=/home/${USER}/trilium-data
|
||||
# Use dumb-init as entrypoint to handle signals properly
|
||||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||
|
||||
# This script will handle UID/GID checks and start the app
|
||||
CMD [ "sh", "-c", "\
|
||||
if [ \"${TRILIUM_UID}\" != \"$(id -u)\" ] || [ \"${TRILIUM_GID}\" != \"$(id -g)\" ]; then \
|
||||
echo \"Detected UID:GID mismatch\"; \
|
||||
if [ \"${TRILIUM_GID}\" != \"$(id -g)\" ]; then \
|
||||
echo \"ERROR: Cannot change GID at runtime in rootless mode.\"; \
|
||||
echo \" Please use docker run with --user ${TRILIUM_UID}:${TRILIUM_GID} instead.\"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
if [ \"${TRILIUM_UID}\" != \"$(id -u)\" ]; then \
|
||||
echo \"ERROR: Cannot change UID at runtime in rootless mode.\"; \
|
||||
echo \" Please use docker run with --user ${TRILIUM_UID}:${TRILIUM_GID} instead.\"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
fi; \
|
||||
# Make sure data directory has correct permissions \
|
||||
mkdir -p \"${TRILIUM_DATA_DIR}\"; \
|
||||
# Start the app \
|
||||
exec node ./main \
|
||||
" ]
|
||||
# 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"]
|
||||
|
||||
HEALTHCHECK --start-period=10s CMD node /home/${USER}/app/docker_healthcheck.js
|
||||
|
||||
Reference in New Issue
Block a user