Created
March 15, 2018 07:03
-
-
Save izinin/c283459551c068d9ab5dafb03bdb310f to your computer and use it in GitHub Desktop.
Dockerfile: dbase provision when docker stack being established
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
# ... YOUR Dockerfile definition here | |
# wait for dependecy ready | |
RUN curl -s https://raw.githubusercontent.com/eficode/wait-for/master/wait-for -o /tmp/wait-for | |
RUN chmod 754 /tmp/wait-for | |
RUN apt-get update | |
RUN apt-get install -y netcat | |
# docker inspect --format="{{json .State.Health}}" sakani-projects-graphql | |
HEALTHCHECK --start-period=30s --retries=10 --timeout=1m CMD \ | |
cd /app; [ -e dbprovision.completed ] || \ | |
/tmp/wait-for $MONGODB_HOST -- \ | |
rails db:create RAILS_ENV=development && \ | |
touch dbprovision.completed | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment