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 built assets from builder
|
||||||
COPY --from=builder --chown=nextjs:nodejs /build/dist /usr/share/nginx/html
|
COPY --from=builder --chown=nextjs:nodejs /build/dist /usr/share/nginx/html
|
||||||
|
|
||||||
# Create required directories
|
# Create required directories and fix permissions for non-root user
|
||||||
RUN mkdir -p /var/cache/nginx /var/run && \
|
RUN mkdir -p /var/cache/nginx /var/run /run && \
|
||||||
chown -R nextjs:nodejs /var/cache/nginx /var/run /usr/share/nginx/html
|
chown -R nextjs:nodejs /var/cache/nginx /var/run /run /usr/share/nginx/html && \
|
||||||
|
chmod 755 /run /var/run
|
||||||
|
|
||||||
# Switch to non-root user
|
# Switch to non-root user
|
||||||
USER nextjs
|
USER nextjs
|
||||||
|
|||||||
Reference in New Issue
Block a user