x-default: &default restart: unless-stopped volumes: - &localtime /etc/localtime:/etc/localtime:ro - &timezone /etc/timezone:/etc/timezone:ro logging: driver: json-file options: max-size: 100m services: nginx: <<: *default image: nginx:${NGINX_VERSION:-1.29.1-alpine3.20} container_name: nginx ports: - "${NGINX_HTTP_PORT_OVERRIDE:-80}:80" - "${NGINX_HTTPS_PORT_OVERRIDE:-443}:443" volumes: - *localtime - *timezone - nginx_logs:/var/log/nginx - ./html:/usr/share/nginx/html:ro # Custom configuration # - ./nginx.conf:/etc/nginx/nginx.conf:ro # - ./conf.d:/etc/nginx/conf.d:ro # - ./ssl:/etc/nginx/ssl:ro environment: - NGINX_HOST=${NGINX_HOST:-localhost} - NGINX_PORT=${NGINX_PORT:-80} deploy: resources: limits: cpus: '1.00' memory: 512M reservations: cpus: '0.25' memory: 64M volumes: nginx_logs: