-
-
Notifications
You must be signed in to change notification settings - Fork 80
Expand file tree
/
Copy pathdocker-compose-dev.yaml
More file actions
52 lines (48 loc) · 1.89 KB
/
docker-compose-dev.yaml
File metadata and controls
52 lines (48 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
services:
backend:
build: ./backend # Point to the backend folder where the Dockerfile is located
ports:
- "8000:8000" # Map host port 8000 to container port 8000
volumes:
- ./backend:/app # Mount backend directory for live code updates
env_file: "./backend/.env" # Use the .env file inside backend
environment:
- IS_DOCKER_CONTAINER=1
- DATABASE_URL=postgresql://postgres:postgres@db:5432/jobseeker_analytics
depends_on:
db:
condition: service_healthy
restart: always # Restart container if it crashes
command: sh -c "alembic upgrade head && uvicorn main:app --reload --host 0.0.0.0 --port 8000"
frontend:
build:
context: ./frontend # Point to the frontend folder where the Dockerfile is located
dockerfile: Dockerfile.dev # Use a specific Dockerfile for development (e.g., Dockerfile.dev)
ports:
- "3000:3000" # Map host port 3000 to container port 3000
volumes:
- ./frontend:/app # Mount the entire frontend directory for live code updates (including components, etc.)
- /app/node_modules # Prevent overwriting of node_modules in the container
env_file: "./frontend/.env"
environment:
- NODE_ENV=development
command: npm run dev # Start the Next.js dev server with hot-reloading
restart: always
db:
image: postgres:13 # Use the official PostgreSQL image
ports:
- "5433:5432" # Map host port 5433 to container port 5432
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: jobseeker_analytics
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d jobseeker_analytics"]
interval: 5s
timeout: 5s
retries: 5
volumes:
- postgres_data:/var/lib/postgresql/data # Persist database data
- ./backend/db/init.sql:/docker-entrypoint-initdb.d/init.sql
volumes:
postgres_data: