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 networks: - petmaster-net 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 networks: - petmaster-net 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: "*" depends_on: postgres: condition: service_healthy redis: condition: service_healthy volumes: - ./api/src:/app/src # hot-reload in dev command: > sh -c "npx prisma generate && npx prisma db push && npm run start:dev" networks: - petmaster-net web: build: context: ./web dockerfile: Dockerfile target: dev container_name: petmaster-web restart: unless-stopped ports: - "3001:3000" environment: REACT_APP_API_URL: http://api:3000 depends_on: - api volumes: - ./web/src:/app/src # hot-reload in dev - ./web/tsconfig.json:/app/tsconfig.json networks: - petmaster-net volumes: pgdata: driver: local redisdata: driver: local networks: petmaster-net: driver: bridge