-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
115 lines (102 loc) · 2.86 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
114
#################################################################################
# This docker manifesto holds the containers we want to build for the application
#################################################################################
# There are mainly 4 containers
# a. Frontend - Has the react application
# b. backend - Go API's router using Gorrilla mux
# c. CORS - NGINX cors reverse proxy server to avoid CORS issue
# d. Mongo - NO SQL database
# d.1 Mongo Express - UI to manage the database
# Swagger and MongoSeed setup is commented. If you want enable them. And it just work :)
version: "3.9"
services:
# Frontend container
templatefrontend:
container_name: template-frontend
image: template-frontend
build:
context: ./frontend
target: development
stdin_open: true
volumes:
- ./frontend/src:/templatefrontend/src
networks:
- template-compose-network
links:
- templateserver
ports:
- 3000:3000
# Backend container
templateserver:
container_name: template-server
image: template-server
build:
context: ./backend
target: development
volumes:
- ./backend:/templateserver
networks:
- template-compose-network
links:
- mongo
ports:
- '4000:4000'
# CORS setup
cors:
build:
context: ./backend/nginx
dockerfile: Dockerfile
container_name: cors
networks:
- template-compose-network
depends_on:
- templateserver
ports:
- "4545:80"
# swagger-ui:
# image: swaggerapi/swagger-ui
# ports:
# - 4001:4001
# environment:
# - API_URL
# networks:
# - template-compose-network
# Mongo container
mongo:
image: mongo:4
volumes:
- ./data:/data/db
networks:
- template-compose-network
ports:
- '27017:27017'
mongo_seed:
env_file:
- ./backend/.env
container_name: mongo_seed
build:
context: ./backend/mongo_seed
dockerfile: Dockerfile
args:
- DATABASE_URI=$MONGOURI
networks:
- template-compose-network
depends_on:
- mongo
# Mongo Express container
mongo-express:
image: mongo-express
environment:
- ME_CONFIG_MONGODB_SERVER=mongo
- ME_CONFIG_MONGODB_PORT=27017
depends_on:
- mongo
networks:
- template-compose-network
ports:
- '8081:8081'
volumes:
- ./data:/data/db
networks:
template-compose-network:
driver: bridge