go-first/docker-compose.yml

95 lines
2 KiB
YAML
Raw Permalink Normal View History

2026-10-07 15:21:47 +02:00
version: '3.8'
services:
app:
build:
context: .
dockerfile: Dockerfile
container_name: go-first-app
ports:
- "8080:8080"
environment:
- SERVER_MODE=release
- SERVER_HOST=0.0.0.0
- SERVER_PORT=8080
env_file:
- .env.production
volumes:
- ./config.yaml:/app/config.yaml:ro
- app_uploads:/app/uploads
- app_logs:/app/logs
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/api/v1/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
networks:
- go-first-network
postgres:
image: postgres:16-alpine
container_name: go-first-postgres
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=go_first
volumes:
- postgres_data:/var/lib/postgresql/data
- ./migrations:/docker-entrypoint-initdb.d:ro
ports:
- "5432:5432"
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
networks:
- go-first-network
redis:
image: redis:7-alpine
container_name: go-first-redis
command: redis-server --appendonly yes
volumes:
- redis_data:/data
ports:
- "6379:6379"
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- go-first-network
nginx:
image: nginx:alpine
container_name: go-first-nginx
ports:
- "80:80"
- "443:443"
volumes:
- ./deploy/nginx.conf:/etc/nginx/nginx.conf:ro
- ./deploy/ssl:/etc/nginx/ssl:ro
- ./web/dist:/var/www/html:ro
- nginx_cache:/var/cache/nginx
depends_on:
- app
restart: unless-stopped
networks:
- go-first-network
volumes:
postgres_data:
redis_data:
app_uploads:
app_logs:
nginx_cache:
networks:
go-first-network:
driver: bridge