fix: resolve nginx pid permission error in web container

- Create /run directory explicitly for nginx.pid
- Set proper ownership and permissions for non-root user
- Fixes 'open() /run/nginx.pid failed (13: Permission denied)' error
This commit is contained in:
Fusion
2026-05-18 10:36:06 +02:00
parent b85ec38ff8
commit fff3ea0c2f
+4 -3
View File
@@ -27,9 +27,10 @@ COPY nginx.conf /etc/nginx/conf.d/default.conf
# Copy built assets from builder
COPY --from=builder --chown=nextjs:nodejs /build/dist /usr/share/nginx/html
# Create required directories
RUN mkdir -p /var/cache/nginx /var/run && \
chown -R nextjs:nodejs /var/cache/nginx /var/run /usr/share/nginx/html
# Create required directories and fix permissions for non-root user
RUN mkdir -p /var/cache/nginx /var/run /run && \
chown -R nextjs:nodejs /var/cache/nginx /var/run /run /usr/share/nginx/html && \
chmod 755 /run /var/run
# Switch to non-root user
USER nextjs