-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
53 lines (49 loc) · 1.61 KB
/
docker-compose.yml
File metadata and controls
53 lines (49 loc) · 1.61 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
53
version: "3.8"
# Define all services (containers) that will be run
services:
# 1. Service for PostgreSQL Database
db:
image: postgres:15-alpine # Using the official lightweight PostgreSQL version 15 image.
container_name: coursify_db
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=20022003
- POSTGRES_DB=coursify
ports:
- "5433:5432"
volumes:
- postgres_data:/var/lib/postgresql/data # Creating persistent database data
restart: unless-stopped
# 2. Service for backend application
backend:
container_name: coursify_backend
# 'build' will tell docker-compose to build the image from the Dockerfile.
build:
context: ./backend # The folder location containing the Dockerfile
ports:
- "8080:8080"
env_file:
- ./backend/.env
environment:
- DB_HOST=db
- DB_PORT=5432
volumes:
- ./backend/uploads:/uploads # Synchronizing the local 'uploads' folder with the one in the container
depends_on:
- db # Instruct Docker to run the 'db' service first before 'app'
restart: unless-stopped
# 3. Service for frontend application
frontend:
container_name: coursify_frontend
build:
context: ./frontend
ports:
- "5173:80" # Access from the browser via localhost:5173, Nginx in the container runs on port 80
environment:
- VITE_API_BASE_URL=http://backend:8080/api
depends_on:
- backend # Instruct Docker to run the 'app' service first before 'frontend'
restart: unless-stopped
# Defining the volume to be used for data persistence
volumes:
postgres_data: