forked from freeCodeCamp/freeCodeCamp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
40 lines (40 loc) · 1.12 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
services:
mongo:
image: mongo
ports:
- '27017:27017'
command: mongod --replSet rs0
setup:
image: mongo
depends_on:
- mongo
restart: on-failure
entrypoint: [
'bash',
'-c',
# This will try to initiate the replica set, until it succeeds twice (i.e. until the replica set is already initialized)
'mongosh --host mongo:27017 --eval ''try {rs.initiate();} catch (err) { if(err.codeName !== "AlreadyInitialized") throw err };'''
]
mailhog:
restart: unless-stopped
image: mailhog/mailhog
ports:
- '1025:1025'
- '8025:8025'
api:
restart: unless-stopped
depends_on:
- mongo
- mailhog
image: fcc-new-api
env_file:
- .env
environment:
# The api cannot connect to mongodb or mailhog via localhost from inside the
# container, so we have to override these variables.
- MONGOHQ_URL=mongodb://mongo:27017/freecodecamp?directConnection=true
- MAILHOG_HOST=mailhog
ports:
# PORT is used by the new api, so we use the less generic API_PORT to
# avoid conflicts.
- '3000:3000'