-
Notifications
You must be signed in to change notification settings - Fork 133
/
docker-compose.yml
113 lines (104 loc) · 3.08 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
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
110
111
112
113
version: '3.8'
# alternative 1 - inject separate env files into containers
# env_file:
# - ./client/.env
# env_file:
# - ./server/.env
#
# alternative 2 - put all vars into single .env and forward vars through docker-compose.yml
# environment: ...
services:
mdp-client:
container_name: mdp-client
restart: unless-stopped
image: nemanjamitic/mern-boilerplate-client:latest
build:
# src must be in context
context: ./client
dockerfile: docker/Dockerfile
depends_on:
- mdp-server
networks:
- internal-client
environment:
- NODE_ENV=production
# forwarded
- REACT_APP_BASE_URL
# env_file:
# - ./client/.env
# nginx ports
# either open port or route through traefik
# ports:
# - '3080:80'
# - '3443:443' # must edit nginx.conf
# handles everything except /api and /public/images
labels:
- 'traefik.enable=true'
- 'traefik.docker.network=proxy'
- 'traefik.http.routers.mb-client-secure.rule=Host(`${SITE_HOSTNAME}`) && !(PathPrefix(`/api`) || PathPrefix(`/auth`) || PathPrefix(`/public/images`))'
- 'traefik.http.routers.mb-client-secure.entrypoints=websecure'
- 'traefik.http.routers.mb-client-secure.service=mb-client-svc'
- 'traefik.http.services.mb-client-svc.loadbalancer.server.port=80'
mdp-server:
container_name: mdp-server
restart: unless-stopped
image: nemanjamitic/mern-boilerplate-server:latest
build:
context: ./server
dockerfile: docker/Dockerfile
depends_on:
- mdp-mongo
environment:
- NODE_ENV=production
# forwarded
- MONGO_URI_PROD
- GOOGLE_CLIENT_ID
- GOOGLE_CLIENT_SECRET
- GOOGLE_CALLBACK_URL
- FACEBOOK_APP_ID
- FACEBOOK_SECRET
- FACEBOOK_CALLBACK_URL
- JWT_SECRET_PROD
- CLIENT_URL_PROD
- SERVER_URL_PROD
# env_file:
# - ./server/.env
volumes:
- ./server/public/images:/home/node/app/server/public/images
networks:
- default
- internal-client
# either open port or route through traefik
# ports:
# - '5000'
# must be exposed through traefik too
# handles /api and /public/images
labels:
- 'traefik.enable=true'
- 'traefik.docker.network=proxy'
- 'traefik.http.routers.mb-server-secure.rule=Host(`${SITE_HOSTNAME}`) && (PathPrefix(`/api`) || PathPrefix(`/auth`) || PathPrefix(`/public/images`))'
- 'traefik.http.routers.mb-server-secure.entrypoints=websecure'
- 'traefik.http.routers.mb-server-secure.service=mb-server-svc'
- 'traefik.http.services.mb-server-svc.loadbalancer.server.port=80'
mdp-mongo:
image: mongo:6.0.3
container_name: mdp-mongo
restart: unless-stopped
ports:
- '27017'
environment:
# forwarded
- MONGO_INITDB_DATABASE
- MONGO_INITDB_ROOT_USERNAME
- MONGO_INITDB_ROOT_PASSWORD
# env_file:
# - ./server/.env
volumes:
- ./server/docker/mongo-data:/data/db
networks:
- default
networks:
default:
name: mdp-default
internal-client:
name: mdp-client