From e140f91d2c53f0d6c75f7850f7002ce4862e2104 Mon Sep 17 00:00:00 2001 From: Greg Date: Mon, 18 Aug 2025 01:14:46 +0200 Subject: [PATCH] Fix entrypoint script creation and permissions --- Dockerfile | 7 ++++--- entrypoint.sh | 8 ++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 entrypoint.sh diff --git a/Dockerfile b/Dockerfile index a0f306a..e9b76e0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,12 +37,13 @@ ENV DATA_DIR=/app/data ENV NODE_ENV=production ENV PORT=80 -# Create startup script to fix volume permissions -RUN echo '#!/bin/sh\nchown -R node:node /app/data\nchmod 755 /app/data\nexec su-exec node "$@"' > /entrypoint.sh && chmod +x /entrypoint.sh - # Install su-exec for user switching RUN apk add --no-cache su-exec +# Copy entrypoint script +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh + EXPOSE 80 HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ CMD curl -fsS http://localhost/api/health >/dev/null || exit 1 diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..40a2d7f --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# Fix permissions for volume-mounted data directory +chown -R node:node /app/data +chmod 755 /app/data + +# Switch to node user and execute the command +exec su-exec node "$@" \ No newline at end of file