- Multi-stage Dockerfile with development and production modes - Docker Compose with caddy-docker-proxy labels for HTTPS - Domain configuration: DOMAIN=rentcache.l.supported.systems - Comprehensive Makefile with development and production targets - Support for external caddy network and Redis backend - Health checks and proper volume management - Environment configuration with .env file Usage: - make setup # Complete setup - make dev # Development with hot reload - make prod # Production deployment - URL: https://rentcache.l.supported.systems
53 lines
1.1 KiB
YAML
53 lines
1.1 KiB
YAML
services:
|
|
rentcache:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
target: ${MODE:-production}
|
|
environment:
|
|
- HOST=0.0.0.0
|
|
- PORT=8000
|
|
- DATABASE_URL=sqlite+aiosqlite:///./data/rentcache.db
|
|
- DEBUG=${DEBUG:-false}
|
|
- LOG_LEVEL=${LOG_LEVEL:-INFO}
|
|
volumes:
|
|
- ./data:/app/data
|
|
- ./logs:/app/logs
|
|
# Development hot-reload
|
|
- ./src:/app/src:ro
|
|
networks:
|
|
- caddy
|
|
expose:
|
|
- "8000"
|
|
labels:
|
|
caddy: ${DOMAIN:-rentcache.l.supported.systems}
|
|
caddy.reverse_proxy: "{{upstreams}}"
|
|
caddy.header.X-Forwarded-Proto: https
|
|
caddy.header.X-Real-IP: "{remote_host}"
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
restart: unless-stopped
|
|
|
|
# Optional Redis for caching
|
|
redis:
|
|
image: redis:7-alpine
|
|
networks:
|
|
- caddy
|
|
volumes:
|
|
- redis_data:/data
|
|
command: redis-server --appendonly yes
|
|
profiles:
|
|
- redis
|
|
restart: unless-stopped
|
|
|
|
networks:
|
|
caddy:
|
|
external: true
|
|
|
|
volumes:
|
|
redis_data:
|
|
driver: local |