feat: add Docker support with PostgreSQL and health check endpoint

This commit is contained in:
2026-03-29 20:38:56 -07:00
parent 5bd1f2359c
commit bcb967017f
7 changed files with 617 additions and 1 deletions
+73
View File
@@ -0,0 +1,73 @@
services:
app:
build:
context: .
target: builder # Use builder stage for development
container_name: euchre-camp-app-dev
ports:
- "3000:3000"
environment:
# Database Configuration for Development
- DATABASE_PROVIDER=postgresql
- DATABASE_URL=postgresql://euchre:euchrepassword@postgres:5432/euchre_camp
- DATABASE_SHADOW_URL=postgresql://euchre:euchrepassword@postgres:5432/euchre_camp_shadow
# Better Auth Configuration
- BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET:-dev-secret-key}
- BETTER_AUTH_URL=${BETTER_AUTH_URL:-http://localhost:3000}
# Application Configuration
- NODE_ENV=development
# Trusted Origins
- TRUSTED_ORIGINS=${TRUSTED_ORIGINS:-http://localhost:3000,http://127.0.0.1:3000}
depends_on:
postgres:
condition: service_healthy
volumes:
# Mount source code for live reload
- .:/app
- /app/node_modules
- /app/.next
- app_data:/app/public/uploads
command: npm run dev
restart: unless-stopped
networks:
- euchre-network
postgres:
image: postgres:15-alpine
container_name: euchre-camp-postgres-dev
environment:
- POSTGRES_DB=euchre_camp
- POSTGRES_USER=euchre
- POSTGRES_PASSWORD=euchrepassword
ports:
- "5433:5432" # Use different port to avoid conflict with local PostgreSQL
volumes:
- postgres_data_dev:/var/lib/postgresql/data
- ./scripts/init-postgres.sh:/docker-entrypoint-initdb.d/init-postgres.sh
healthcheck:
test: ["CMD-SHELL", "pg_isready -U euchre -d euchre_camp"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
restart: unless-stopped
networks:
- euchre-network
volumes:
postgres_data_dev:
driver: local
app_data:
driver: local
networks:
euchre-network:
driver: bridge