- Remove version declaration to avoid warnings - Add healthcheck for service monitoring - Set timezone to Asia/Taipei - Configure logging with size limits - Use read-only mount for config files - Add service description label - Remove redundant 'command: serve' - Improve configuration structure and organization Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
49 lines
976 B
YAML
49 lines
976 B
YAML
services:
|
|
headscale:
|
|
image: headscale/headscale:latest
|
|
container_name: headscale
|
|
restart: unless-stopped
|
|
networks:
|
|
- shared-net
|
|
|
|
# 環境變數
|
|
environment:
|
|
- TZ=Asia/Taipei
|
|
|
|
# 健康檢查
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "headscale version >/dev/null 2>&1 || exit 1"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
|
|
# 日誌配置
|
|
logging:
|
|
driver: "json-file"
|
|
options:
|
|
max-size: "10m"
|
|
max-file: "3"
|
|
|
|
# 卷掛載
|
|
volumes:
|
|
- ./config:/etc/headscale:ro
|
|
- ./data:/var/lib/headscale
|
|
- /etc/localtime:/etc/localtime:ro
|
|
|
|
# 埠位映射
|
|
ports:
|
|
- "8080:8080" # HTTP API
|
|
- "9090:9090" # Metrics
|
|
- "50443:50443" # gRPC
|
|
|
|
# 標籤配置
|
|
labels:
|
|
- "com.centurylinklabs.watchtower.enable=true"
|
|
- "description=Headscale WireGuard control plane"
|
|
|
|
networks:
|
|
shared-net:
|
|
external: true
|
|
|