diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..ec88c7c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,49 @@ +services: + db: + image: postgres:16-alpine + restart: unless-stopped + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-networkapp123} + POSTGRES_DB: networkapp + volumes: + - postgres_data:/var/lib/postgresql/data + ports: + - "5432:5432" + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres"] + interval: 5s + timeout: 5s + retries: 5 + + api: + build: . + restart: unless-stopped + ports: + - "${PORT:-3000}:3000" + environment: + DATABASE_URL: postgresql://postgres:${POSTGRES_PASSWORD:-networkapp123}@db:5432/networkapp + PORT: 3000 + APP_URL: ${APP_URL:-http://localhost:3000} + ALLOWED_ORIGINS: ${ALLOWED_ORIGINS:-http://localhost:3000,http://localhost:8080} + BETTER_AUTH_SECRET: ${BETTER_AUTH_SECRET} + ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY} + RESEND_API_KEY: ${RESEND_API_KEY} + DEFAULT_FROM_EMAIL: ${DEFAULT_FROM_EMAIL:-onboarding@resend.dev} + depends_on: + db: + condition: service_healthy + + migrate: + build: . + command: ["bun", "run", "db:push"] + environment: + DATABASE_URL: postgresql://postgres:${POSTGRES_PASSWORD:-networkapp123}@db:5432/networkapp + depends_on: + db: + condition: service_healthy + profiles: + - migrate + +volumes: + postgres_data: