Files
petmaster/docker-compose.yml
T

103 lines
2.3 KiB
YAML

services:
postgres:
image: postgres:16-alpine
container_name: petmaster-postgres
restart: unless-stopped
environment:
POSTGRES_DB: petmaster
POSTGRES_USER: petmaster
POSTGRES_PASSWORD: petmaster_secret
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U petmaster"]
interval: 5s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
container_name: petmaster-redis
restart: unless-stopped
ports:
- "6379:6379"
volumes:
- redisdata:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 10
start_period: 5s
api:
build:
context: ./api
dockerfile: Dockerfile
target: dev
container_name: petmaster-api
restart: unless-stopped
ports:
- "3000:3000"
environment:
DATABASE_URL: postgresql://petmaster:petmaster_secret@postgres:5432/petmaster?schema=public
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET:-change-me-in-production}
STRIPE_SECRET_KEY: ${STRIPE_SECRET_KEY:-sk_test_placeholder}
STRIPE_WEBHOOK_SECRET: ${STRIPE_WEBHOOK_SECRET:-whsec_placeholder}
CORS_ORIGIN: http://localhost:3001
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
volumes:
- ./api/src:/app/src # hot-reload in dev
command: >
sh -c "npx prisma migrate deploy && npx prisma seed && npm run start:dev"
networks:
- petmaster-net
web:
build:
context: ./web
dockerfile: Dockerfile
target: dev
container_name: petmaster-web
restart: unless-stopped
ports:
- "3001:3001"
environment:
REACT_APP_API_URL: http://localhost:3000
depends_on:
- api
networks:
- petmaster-net
nginx:
image: nginx:alpine
container_name: petmaster-nginx
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./web/nginx.conf:/etc/nginx/nginx.conf
depends_on:
- web
- api
networks:
- petmaster-net
volumes:
pgdata:
driver: local
redisdata:
driver: local
networks:
petmaster-net:
driver: bridge