FROM nginx:alpine # Install curl for health checks RUN apk add --no-cache curl # Remove default nginx config RUN rm /etc/nginx/conf.d/default.conf # Copy custom configurations COPY ./conf/nginx.prod.conf /etc/nginx/conf.d/default.conf COPY ./conf/ssl.conf /etc/nginx/conf.d/ssl.conf COPY ./conf/security.conf /etc/nginx/conf.d/security.conf # Create nginx user and set permissions RUN addgroup -g 1001 -S nginx && \ adduser -S nginx -u 1001 -G nginx # Create necessary directories RUN mkdir -p /var/cache/nginx /var/log/nginx /var/run \ && chown -R nginx:nginx /var/cache/nginx /var/log/nginx /var/run EXPOSE 80 443 CMD ["nginx", "-g", "daemon off;"]