-
Notifications
You must be signed in to change notification settings - Fork 251
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
109 lines (95 loc) · 3.21 KB
/
docker-compose.yml
File metadata and controls
109 lines (95 loc) · 3.21 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# 1. Update config values (localhost --> mongo and localhost --> redis) in config/config.development.json if necessary.
# 2. Set APP_ENV environment variable by running the following command in your commnand window (see the notes below if on Windows).
# export APP_ENV=development or export APP_ENV=production
# export DOCKER_ACCT=codewithdan
# NOTE: If you're on Windows use one of the following commands to create the environment variables.
# Use 'codewithdan' for the account if you want to run in Kubernetes (see the readme). Otherwise, you can substitute your own
# Docker account for the value if you'd like.
# For the standard Windows DOS command shell use `set` instead of `export` for environment variables.
# For Windows Powershell use `$env:APP_ENV = "value"`.
# $env:APP_ENV="development" or $env:APP_ENV="production"
# $env:DOCKER_ACCT="codewithdan"
# 3. Remove "node" service `volume` (below) only if doing a production build
# - For development, make sure you ran `npm install` first, so that node_modules will be available on the volume for the node app to run
# 4. Run docker-compose build
# 5. Run docker-compose up
# 6. Live long and prosper
version: "3.7"
services:
nginx:
container_name: nginx
image: ${DOCKER_ACCT}/nginx
build:
context: .
dockerfile: .docker/nginx.${APP_ENV}.dockerfile
# links are deprecated (networks are used instead for communication and
# depends_on for upstream node name in nginx config)
# links:
# - node1:node1
# - node2:node2
# - node3:node3
depends_on:
- node
restart: on-failure
ports:
- "80:80"
- "443:443"
networks:
- codewithdan-network
node:
image: ${DOCKER_ACCT}/node-codewithdan
build:
context: .
dockerfile: .docker/node-codewithdan.${APP_ENV}.dockerfile
ports:
- "8080"
volumes:
- .:/var/www/codewithdan
working_dir: /var/www/codewithdan
env_file:
- ./.docker/env/app.${APP_ENV}.env
depends_on:
- mongo
- redis
# scale: 3
deploy:
replicas: 3
networks:
- codewithdan-network
mongo:
container_name: mongo
image: ${DOCKER_ACCT}/mongo
build:
context: .
dockerfile: .docker/mongo.dockerfile
ports:
- "27017:27017"
env_file:
- ./.docker/env/mongo.${APP_ENV}.env
networks:
- codewithdan-network
redis:
container_name: redis
image: ${DOCKER_ACCT}/redis
build:
context: .
dockerfile: .docker/redis.${APP_ENV}.dockerfile
ports:
- "6379:6379"
networks:
- codewithdan-network
# cadvisor:
# container_name: cadvisor
# image: google/cadvisor
# volumes:
# - /:/rootfs:ro
# - /var/run:/var/run:rw
# - /sys:/sys:ro
# - /var/lib/docker/:/var/lib/docker:ro
# ports:
# - "8080:8080"
# networks:
# - codewithdan-network
networks:
codewithdan-network:
driver: bridge