-
Notifications
You must be signed in to change notification settings - Fork 3
/
docker-compose.yml
70 lines (66 loc) · 2.62 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
version: '3.8'
services:
# Back-end API Node.js Server
back-end-api:
env_file:
- ./Back_End/.env
# Since we have a Dockerfile, we don't need to specify the line below. It is commented out
# image: node: 12.18.3
container_name: face-recognition-backend
# build allows us to build from our own Dockerfile instead of a default Image like node:8.11.1
# build references the Dockerfile in the root directory
build: ./Back_End
command: npm start
working_dir: /usr/src/Back_End
# These environmental variables are referenced by the connection in server.js through a process.env
environment:
POSTGRES_USER: admin
POSTGRES_PASSWORD: password
POSTGRES_DB: face-recognition-database-docker
POSTGRES_HOST: postgres
REDIS_URL: redis://redis-cache
# The first 3000 represents the port on your local machine, the : represents forwarding, and second 3000 represents the port of the container
ports:
- "3000:3000"
# volumes allows access to the file system of the container
# ./ represents the directory of your local machine, the : represents forwarding, and /usr/src/Back_End represents the directory of the container
# This enables changes made on your local machine to populate in the container automatically
volumes:
- ./Back_End:/usr/src/Back_End
# - /usr/src/Back_End/node_modules
# Redis Database
redis:
image: redis
container_name: redis-cache
command: redis-server
ports:
- "6379:6379"
# PostgreSQL Database
postgres:
# To connect the back-end-api service to our database, we need to include the environment below in both our database service and back-end-api service
environment:
POSTGRES_USER: admin
POSTGRES_PASSWORD: password
POSTGRES_DB: face-recognition-database-docker
POSTGRES_HOST: postgres
# Telling Docker to run whatever is in the postgres directory on our local machine. In this case, we will get tables generated for our database in the Docker container
build: ./Back_End/postgres
# The first 5432 represents the port on your local machine, the : represents forwarding, and the second 5432 represents the port of the container
ports:
- "5432:5432"
# Front-end React User Interface
react-ui:
env_file:
- ./Front_End/.env
container_name: face-recognition-frontend
build: ./Front_End
command: npm start
working_dir: /usr/src/Front_End
ports:
- "3001:3001"
stdin_open: true
environment:
- CHOKIDAR_USEPOLLING=true
volumes:
- ./Front_End:/usr/src/Front_End
# - /usr/src/Front_End/node_modules