Skip to content

Instantly share code, notes, and snippets.

Created February 6, 2016 23:44
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
# we'll call our web app of web
# it'll build this container based the docker file ./Dockerfile
build: .
# it'll run this command to star the server
command: bash -c "rm -f tmp/pids/ || true && bundle exec rails s -p 3000 -b ''"
# it'll export the port 3000
- "3000:3000"
# it links to db container (on mongoid.yaml at rail's config we say host: db:27017 it's linked)
- db
# we called our db container of db :)
# instead of building it from zero we'll use an existent image (see docker hub)
image: mongo
# it needs to persist data so we keep it (even if we "kill" the container)
- /data/db
# we export the port 27017 :B
- "27017:27017"
# we'll use nginx as web server
# it'll restart when the container does too
restart: always
# we're going to build this container from docker file ./docker/nginx/Dockerfile
build: ./docker/nginx/
# we're gonna expose 80
- "80:80"
# since we'll be a proxy we need to be linked to our web app (upstream= web:3000)
- web:web
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment