Introduced a new `frontend` service in `docker-compose.yml`, complete with build, healthchecks, and networking. Added a multi-stage Dockerfile for the frontend, a `.dockerignore` file, and a startup script to wait for the backend. Updated Next.js configuration for Docker compatibility and added API type definitions.
67 lines
1.4 KiB
YAML
67 lines
1.4 KiB
YAML
services:
|
|
db:
|
|
image: postgres:17-alpine
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data/
|
|
environment:
|
|
- POSTGRES_USER=postgres
|
|
- POSTGRES_PASSWORD=postgres
|
|
- POSTGRES_DB=eventspace
|
|
ports:
|
|
- "5432:5432"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- app-network
|
|
|
|
backend:
|
|
build:
|
|
context: ./backend
|
|
dockerfile: Dockerfile
|
|
volumes:
|
|
- ./backend:/app
|
|
- ./uploads:/app/uploads
|
|
ports:
|
|
- "8000:8000"
|
|
environment:
|
|
- DATABASE_URL=postgresql://postgres:postgres@db:5432/eventspace
|
|
- SECRET_KEY=your_secret_key_here
|
|
- ENVIRONMENT=development
|
|
- DEBUG=true
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
networks:
|
|
- app-network
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
dockerfile: Dockerfile
|
|
args:
|
|
- NEXT_PUBLIC_API_URL=http://backend:8000
|
|
ports:
|
|
- "3000:3000"
|
|
environment:
|
|
- NODE_ENV=production
|
|
- NEXT_PUBLIC_API_URL=http://backend:8000
|
|
depends_on:
|
|
- backend
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--spider", "http://localhost:3000"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 3
|
|
networks:
|
|
- app-network
|
|
|
|
|
|
volumes:
|
|
postgres_data:
|
|
|
|
networks:
|
|
app-network:
|
|
driver: bridge
|