Fix entrypoint script creation and permissions
This commit is contained in:
parent
f25f8ddcb1
commit
e140f91d2c
@ -37,12 +37,13 @@ ENV DATA_DIR=/app/data
|
|||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
ENV PORT=80
|
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
|
# Install su-exec for user switching
|
||||||
RUN apk add --no-cache su-exec
|
RUN apk add --no-cache su-exec
|
||||||
|
|
||||||
|
# Copy entrypoint script
|
||||||
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
RUN chmod +x /entrypoint.sh
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
||||||
CMD curl -fsS http://localhost/api/health >/dev/null || exit 1
|
CMD curl -fsS http://localhost/api/health >/dev/null || exit 1
|
||||||
|
|||||||
8
entrypoint.sh
Normal file
8
entrypoint.sh
Normal file
@ -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 "$@"
|
||||||
Loading…
x
Reference in New Issue
Block a user