-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
73 lines (71 loc) · 2.03 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
66
67
68
69
70
71
72
73
x-db-env: &db-env
MYSQL_SERVER: mysql
MYSQL_USER: chemistrycafedev
MYSQL_PASSWORD: chemistrycafe
MYSQL_DATABASE: chemistry_db
services:
mysql:
image: mysql:9.0
container_name: mysql
ports:
- "3306:3306" # MySQL default port
volumes:
- db_data:/var/lib/mysql
- ./init.sql:/docker-entrypoint-initdb.d/init.sql # run initial sql script
environment:
<<: *db-env
MYSQL_ROOT_PASSWORD: chemistrycafefall24
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 10s
timeout: 5s
retries: 5
networks:
- app-network
frontend:
container_name: 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
# - ASPNETCORE_URLS=http://0.0.0.0:8080
- API_URL=http://backend:8080 # This points to the backend service within the Docker network
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:
container_name: backend
build:
context: ./backend # Path to your back-end repository
dockerfile: Dockerfile
ports:
- "8080:8080" # Map host port to container port
environment:
<<: *db-env
ASPNETCORE_ENVIRONMENT: Development
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}
GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET}
networks:
- app-network
command: ["dotnet", "watch", "run", "--project", "ChemistryCafeAPI.csproj"] # Command for development
volumes:
db_data:
networks:
app-network:
driver: bridge