Skip to content

Instantly share code, notes, and snippets.

@izinin
Created March 15, 2018 07:03
Show Gist options
  • Save izinin/c283459551c068d9ab5dafb03bdb310f to your computer and use it in GitHub Desktop.
Save izinin/c283459551c068d9ab5dafb03bdb310f to your computer and use it in GitHub Desktop.
Dockerfile: dbase provision when docker stack being established
# ... 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