This repository has been archived by the owner on Mar 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
66 lines (66 loc) · 1.8 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
# Version of Docker-compose
version: '3.8'
services:
# Service name
node:
# Creating a custom image
build:
# Location to the Dockerfile
context: ./server
# Name of the Dockerfile
dockerfile: Dockerfile
ports:
# External port:Internal port
- 5000:5000
volumes:
# Syntax <nameOfVolume>:<directorInDocker>
# ADD THE CONFIGURATION FROM THIS POINT to sync the working directory
# for the application to the /app directory in the container
- /server
- /server/node_modules
env_file:
- ./server/.env
depends_on:
- mongo
# Add the react service
react:
build:
# Location to the dockerfile
context: ./client
# Name of the dockerfile
dockerfile: Dockerfile
volumes:
# Bind-mounts configuration
- /client/public
# Ignoring any changes made in "node_modules" folder
- /client/node_modules
ports:
# External port:Internal port
- 3000:3000
depends_on:
# Starts up the node service before starting up the react service
- node
environment:
# Enabling hot reload
- CHOKIDAR_USEPOLLING=true
mongo:
image: mongo
environment:
MONGODB_USER: "$DB_USER"
MONGODB_PASS: "$DB_PASSWORD"
MONGODB_DATABASE: "$DB_DATABASE"
MONGO_INITDB_ROOT_USERNAME: "$MONGO_INITDB_ROOT_USERNAME"
MONGO_INITDB_ROOT_PASSWORD: "$MONGO_INITDB_ROOT_PASSWORD"
MONGO_INITDB_DATABASE: "$MONGO_INITDB_DATABASE"
env_file:
- ./server/.env
ports:
- 27000:27000
volumes:
- mongo:/data/db
- ./server/config/mongo_setup.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
# Making the node service volume accessible to other services.
volumes:
# Declaring the node service volume.
nodeVolume:
mongo: