-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
51 lines (47 loc) · 1.18 KB
/
docker-compose.yml
File metadata and controls
51 lines (47 loc) · 1.18 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
version: '3.8'
services:
# Service 1: Database MySQL
db:
image: mysql:8.0
container_name: hackathon_db
restart: always
environment:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: hackathon_imphnen
MYSQL_USER: tunggubang
MYSQL_PASSWORD: user123
ports:
- "3306:3306"
volumes:
- db_data:/var/lib/mysql
- ./backend/db.sql:/docker-entrypoint-initdb.d/init.sql
# Service 2: Backend (PHP Native)
backend:
build: ./backend
container_name: hackathon_backend
ports:
- "8080:80" # Akses di localhost:8080
volumes:
- ./backend:/var/www/html
depends_on:
- db
environment:
DB_HOST: db
DB_USER: root
DB_PASS: rootpassword
DB_NAME: hackathon_imphnen
# Service 3: Frontend (Next.js)
frontend:
build: ./frontend
container_name: hackathon_frontend
ports:
- "3000:3000" # Akses di localhost:3000
volumes:
- ./frontend:/app
- /app/node_modules # Mencegah conflict node_modules laptop vs container
environment:
NEXT_PUBLIC_API_URL: http://localhost:8080
NEXT_PUBLIC_GOOGLE_API_KEY:
command: npm run dev
volumes:
db_data: