-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yaml
47 lines (45 loc) · 1.5 KB
/
docker-compose.yaml
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
services:
##### FRONTEND (NodeJS React) #####
frontend:
container_name: braden-frontend
tty: true
restart: on-failure
build:
context: .
dockerfile: ./frontend/Dockerfile
networks:
- braden-network
ports:
- 8000:8000
volumes:
- ./frontend/src:/app/src
depends_on: # Depends on backend to be running and healthy before starting.
backend:
condition: service_healthy
##### BACKEND (NodeJS Express API) #####
backend:
container_name: braden-backend
tty: true
init: true # Properly handles running as PID 1 inside a container. Source: https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#handling-kernel-signals
restart: on-failure
healthcheck:
test: ["CMD-SHELL", "node", "/app/healthcheck.js"] # Check health endpoint for healthy service.
interval: 30s # Perform the health check every 30 seconds.
timeout: 10s # Consider the health check a failure if it takes more than 10 seconds.
retries: 5 # Retry the health check up to 5 times before considering the container unhealthy.
build:
context: .
dockerfile: ./backend/Dockerfile
networks:
- braden-network
ports:
- 8008:8008
volumes:
- ./backend:/app
environment:
- PORT=8008
- FRONTEND_URL=http://localhost:8000
- BACKEND_URL=http://localhost:8008
networks:
braden-network:
driver: "bridge" # Internal network that allows containers to communicate with each other.