forked from srinivas1987devops/spring-boot-mongo-docker
-
Notifications
You must be signed in to change notification settings - Fork 617
/
docker-compose.yml
executable file
·45 lines (41 loc) · 994 Bytes
/
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
version: '3.1'
services:
springboot:
image: dockerhandson/spring-boot-mongo:latest
restart: always # This will be ignored if we deploy in docker swarm
environment:
- MONGO_DB_HOSTNAME=mongo
- MONGO_DB_USERNAME=devdb
- MONGO_DB_PASSWORD=devdb123
ports:
- 8080:8080
working_dir: /opt/app
depends_on:
- mongo
networks:
- springappnetwork
deploy: # This will be considered only in docker swarm.
replicas: 2
update_config:
parallelism: 1
delay: 20s
restart_policy:
condition: on-failure
delay: 10s
max_attempts: 5
mongo:
image: mongo
environment:
- MONGO_INITDB_ROOT_USERNAME=devdb
- MONGO_INITDB_ROOT_PASSWORD=devdb123
volumes:
- mongodb:/data/db
restart: always
networks:
- springappnetwork
volumes:
mongodb:
external: true
networks:
springappnetwork:
external: true