Files
compose-anything/src/nginx/docker-compose.yaml
2025-11-10 19:55:44 +08:00

45 lines
1.1 KiB
YAML

x-defaults: &defaults
restart: unless-stopped
logging:
driver: json-file
options:
max-size: 100m
max-file: "3"
services:
nginx:
<<: *defaults
image: ${GLOBAL_REGISTRY:-}nginx:${NGINX_VERSION:-1.29.2-alpine3.22}
ports:
- "${NGINX_HTTP_PORT_OVERRIDE:-80}:80"
- "${NGINX_HTTPS_PORT_OVERRIDE:-443}:443"
volumes:
- 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:
- TZ=${TZ:-UTC}
- NGINX_HOST=${NGINX_HOST:-localhost}
- NGINX_PORT=${NGINX_PORT:-80}
deploy:
resources:
limits:
cpus: ${NGINX_CPU_LIMIT:-1.00}
memory: ${NGINX_MEMORY_LIMIT:-512M}
reservations:
cpus: ${NGINX_CPU_RESERVATION:-0.25}
memory: ${NGINX_MEMORY_RESERVATION:-64M}
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:80/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
volumes:
nginx_logs: