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:
+4
-3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user