simplelink/docker-compose.yml
2025-01-31 19:17:07 -05:00

55 lines
1.2 KiB
YAML

services:
db:
image: postgres:15-alpine
container_name: shortener-db
environment:
POSTGRES_DB: shortener
POSTGRES_USER: shortener
POSTGRES_PASSWORD: shortener123
ports:
- "5432:5432"
volumes:
- shortener-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U shortener"]
interval: 5s
timeout: 5s
retries: 5
networks:
- shortener-network
app:
build:
context: .
dockerfile: Dockerfile
container_name: shortener-app
ports:
- "8080:8080"
environment:
- DATABASE_URL=postgresql://shortener:shortener123@db:5432/shortener
- SERVER_HOST=0.0.0.0
- SERVER_PORT=8080
- JWT_SECRET=change-me-in-production
depends_on:
db:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/api/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
- shortener-network
deploy:
restart_policy:
condition: on-failure
max_attempts: 3
window: 120s
networks:
shortener-network:
driver: bridge
volumes:
shortener-data: