Created
August 22, 2019 04:25
-
-
Save timjonesdev/d756b5b01dc1a1c0fabaca90116f3f82 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.0" | |
services: | |
# Core Spring Boot Application | |
app: | |
build: | |
context: .. | |
dockerfile: ./Dockerfile | |
image: "rx_mongo_example" | |
env_file: | |
- .env | |
links: | |
- mongo | |
ports: | |
- 8080:8080 | |
# MongoDB - Reactive Persistence | |
mongo: | |
build: | |
context: mongo | |
dockerfile: Dockerfile | |
image: "mongodb" | |
hostname: mongo | |
ports: | |
- 27017:27017 | |
volumes: | |
- mongodata:/data/db | |
env_file: | |
- mongo/.env | |
# The mongo-seed container is just for waiting until the main mongo container is done setting its replicaset up | |
# and then initializing data. | |
mongo-seed: | |
build: | |
context: mongo_seed | |
dockerfile: Dockerfile | |
# ping the main mongo instance relentlessly until the connection is ready, then wait, then run an initialize data script to populate data. | |
command: bash -c "until mongo mongo:27017/fantasy_db; do echo 'Waiting for Mongo to be ready...'; sleep 1; done; sleep 3; mongo mongo:27017/fantasy_db init.js; " | |
links: | |
- mongo | |
volumes: | |
mongodata: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment