Files
michaelschiemer/docker/nginx/Dockerfile.production
Michael Schiemer 85e2360a90
All checks were successful
Test Runner / test-basic (push) Successful in 8s
Test Runner / test-php (push) Successful in 7s
Deploy Application / deploy (push) Successful in 1m35s
fix(deploy): improve deployment robustness and reliability
- Add docker volume prune to deploy.sh to prevent stale code issues
- Add automatic migrations and cache warmup to staging entrypoint
- Fix nginx race condition by waiting for PHP-FPM before starting
- Improve PHP healthcheck to use php-fpm-healthcheck
- Add curl to production nginx Dockerfile for healthchecks
- Add ensureSeedsTable() to SeedRepository for automatic table creation
- Update SeedCommand to ensure seeds table exists before operations

This prevents 502 Bad Gateway errors during deployment and ensures
fresh code is deployed without volume cache issues.
2025-11-25 17:44:44 +01:00

56 lines
1.3 KiB
Docker

FROM macbre/nginx-http3
# Install Certbot for Let's Encrypt
USER root
# Install dependencies
RUN apk add --no-cache \
certbot \
certbot-nginx \
su-exec \
netcat-openbsd \
curl \
openssl \
bash
# Remove default site
RUN rm -f /etc/nginx/conf.d/default.conf || true
# Create necessary directories
RUN mkdir -p \
/var/cache/nginx \
/var/log/nginx \
/var/www/ssl \
/var/www/certbot \
/var/www/html/public/.well-known/acme-challenge \
/etc/letsencrypt \
/var/lib/letsencrypt
# Set permissions
RUN chmod 755 /var/cache/nginx /var/log/nginx /var/www/ssl /var/www/certbot && \
chmod a+rw /dev/stdout /dev/stderr
# Copy configurations
COPY ./nginx.conf /etc/nginx/nginx.conf
COPY ./default.production.conf /etc/nginx/conf.d/default.conf
COPY ./ssl/ /var/www/ssl/
# Copy entry scripts
COPY ./docker-entrypoint-production.sh /usr/local/bin/docker-entrypoint.sh
COPY ./certbot-renew.sh /usr/local/bin/certbot-renew.sh
RUN chmod +x /usr/local/bin/docker-entrypoint.sh /usr/local/bin/certbot-renew.sh
# Set ownership
RUN chown -R nginx:nginx \
/var/cache/nginx \
/var/log/nginx \
/var/www/ssl \
/var/www/certbot \
/etc/letsencrypt \
/var/lib/letsencrypt
EXPOSE 80 443
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"]