-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
49 lines (46 loc) · 1.58 KB
/
docker-compose.yml
File metadata and controls
49 lines (46 loc) · 1.58 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
services:
db:
image: mysql:8.0
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: "yes" # Allows MySQL to run without a password
MYSQL_DATABASE: ${DB_NAME}
TZ: Europe/Istanbul
ports:
- "3307:3306" # Map port 3306 in the container to 3307 on your host to avoid conflicts
volumes:
- ./database/init.sql:/docker-entrypoint-initdb.d/init.sql # Initialize with the SQL file
- ./database/sample_data.sql:/docker-entrypoint-initdb.d/sample_data.sql # Add sample data to the database
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 10s
timeout: 5s
retries: 5
backend:
build:
context: ./backend
ports:
- "5001:5000" # Map port 5000 in the container to 5001 on your host to avoid conflicts
volumes:
- ./backend:/usr/src/app
- /usr/src/app/node_modules # Prevents overwriting node_modules
- ./backend/src/assets:/usr/src/app/src/assets # Mount static assets directory for images
depends_on:
db:
condition: service_healthy
environment:
PORT: ${PORT}
DB_HOST: ${DB_HOST}
DB_USER: ${DB_USER}
DB_PASS: ${DB_PASS}
DB_NAME: ${DB_NAME}
JWT_SECRET: ${JWT_SECRET}
command: npx nodemon src/index.js # Use nodemon for live reloading during development
frontend:
build:
context: ./frontend
ports:
- "3000:3000"
volumes:
- ./frontend:/usr/src/app
- /usr/src/app/node_modules # Prevents overwriting node_modules
command: npm start # Start the frontend using the development server