-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-compose.yml
71 lines (66 loc) · 2.36 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
version: '3.1'
name: 'nest-pret-dev'
services:
mongo:
image: mongo
volumes:
- nest-pret-dev-mongo-data:/data/db
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: example
networks:
- nest-pret-dev-internal-network
mongo-express:
image: mongo-express
ports:
- 8081:8081
networks:
- nest-pret-dev-internal-network
environment:
ME_CONFIG_MONGODB_ENABLE_ADMIN: true
ME_CONFIG_MONGODB_ADMINUSERNAME: root
ME_CONFIG_MONGODB_ADMINPASSWORD: example
ME_CONFIG_MONGODB_SERVER: mongo
ME_CONFIG_MONGODB_PORT: 27017
ME_CONFIG_BASICAUTH: "false"
depends_on:
- mongo
api:
image: api
build: .
restart: always
command: npm run start:dev
env_file: .env
environment:
- NODE_ENV=development
ports:
- 3000:3000
volumes:
- type: bind
source: .
target: /usr/src/app
networks:
- nest-pret-dev-internal-network
depends_on:
- mongo
healthcheck:
# the command 'docker compose up' waits for this healthcheck before showing the welcome message during development
# see: https://docs.docker.com/engine/reference/commandline/compose_up/
# since we don't want to wait for too long before showing the message, we want to use a low internal number here
# we're using 10s here, but this is very wastefull outside of initial boot
# ideally we would check every 2 or 3 seconds during startup, and them only every 60 seconds after that
# the property required to do this is start_interval, but...
# TODO start_interval requires docker engine >= 25, which has not yet been released https://github.com/docker/compose/issues/10830
# it depends on moby/moby 1.25, the milestone progress can be tracked here: https://github.com/moby/moby/milestone/119
# documentation for it is here: https://docs.docker.com/engine/reference/builder/#healthcheck
test: wget --no-verbose --tries=1 --spider http://localhost:3000/health/replica || exit 1
interval: 10s # TODO for now we'll go with a 10s internal
# interval: 60s # But it should be 60 after docker engine 25
# start_interval: 2s # TODO this requires docker engine 25
start_period: 30s
retries: 5
timeout: 5s
volumes:
nest-pret-dev-mongo-data:
networks:
nest-pret-dev-internal-network: