-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
65 lines (64 loc) · 1.92 KB
/
docker-compose.yml
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
54
55
56
57
58
59
60
61
62
63
64
65
services:
mysql:
image: mysql:9.0
env_file:
- .env
ports:
- "3307:3306" # MySQL default port
volumes:
- db_data:/var/lib/mysql
- ./init.sql:/docker-entrypoint-initdb.d/init.sql # run initial sql script
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} # Set in your .env file
MYSQL_DATABASE: ${MYSQL_DATABASE} # Set in your .env file
MYSQL_USER: ${MYSQL_USER} # Set in your .env file
MYSQL_PASSWORD: ${MYSQL_PASSWORD} # Set in your .env file
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 10s
timeout: 5s
retries: 5
networks:
- app-network
frontend:
build:
context: ./frontend # Path to your front-end repository
dockerfile: Dockerfile
ports:
- "5173:5173"
depends_on:
- backend # Ensure the backend service starts before frontend
environment:
- ASPNETCORE_ENVIRONMENT=Development
- API_URL=http://backend:8080 # This points to the backend service within the Docker network
- ASPNETCORE_URLS=http://0.0.0.0:8080
networks:
- app-network
# test code by britt to enable live updates to frontend with docker
# use docker compose up w--watch
develop:
watch:
- action: sync
path: ./frontend
target: /app
ignore:
- node_modules/
- action: rebuild
path: package.json
command: ["npm", "run", "dev"] # Command for development
backend:
build:
context: ./backend # Path to your back-end repository
dockerfile: Dockerfile
ports:
- "8080:8080" # Map host port to container port
environment:
- ASPNETCORE_ENVIRONMENT=Development
networks:
- app-network
command: ["dotnet", "watch", "run", "--project", "ChemistryCafeAPI.csproj"] # Command for development
volumes:
db_data:
networks:
app-network:
driver: bridge