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