62 lines
1.4 KiB
YAML
62 lines
1.4 KiB
YAML
version: "3.9"
|
|
|
|
# Common defaults for all services - use with: <<: *default-service
|
|
x-common: &default-service
|
|
restart: unless-stopped
|
|
env_file:
|
|
- .env
|
|
networks:
|
|
- home_network
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
|
|
services:
|
|
my-service:
|
|
# Inherit common defaults
|
|
<<: *default-service
|
|
|
|
# Use specific image version tag, never :latest
|
|
image: example/app:1.2.3
|
|
|
|
# Environment Management
|
|
environment:
|
|
TZ: America/New_York
|
|
PUID: "1000"
|
|
PGID: "1000"
|
|
# Add service-specific env vars here
|
|
|
|
# Networking - port mapping (optional)
|
|
ports:
|
|
- "8080:8080"
|
|
|
|
# Resource Constraints (native Compose limits, not Swarm deploy)
|
|
mem_limit: 512M
|
|
cpus: 0.5
|
|
|
|
# Persistent Storage
|
|
volumes:
|
|
- ./config:/config
|
|
- ./data:/data
|
|
- /etc/localtime:/etc/localtime:ro
|
|
|
|
# Health Checks (customize based on your service)
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
|
|
networks:
|
|
home_network:
|
|
external: true
|
|
# If proxy_network does not exist, create it first:
|
|
# docker network create proxy_network
|
|
|
|
# Alternatively, manage the network in this file:
|
|
# driver: bridge
|
|
# driver_opts:
|
|
# com.docker.network.bridge.name: "br-proxy" |