Skip to content

Instantly share code, notes, and snippets.

@chrisedington
Created October 27, 2016 09:04
Show Gist options
  • Save chrisedington/2541857770c29156f94d492281d0c656 to your computer and use it in GitHub Desktop.
Save chrisedington/2541857770c29156f94d492281d0c656 to your computer and use it in GitHub Desktop.
# service configuration for production database (Postgres)
db:
# use stock postgres image
image: postgres:9.4.5
# persist the database between containers by storing it in a volume
volumes:
- myapp-postgres:/var/lib/postgresql/data
# service configuration for production application server (Unicorn)
app:
# use the application server image pulled from Docker Hub
image: madeagency/myapp_app:$DEPLOY_TAG
# sources environment variable configuration for our app
env_file: .env
# rely on the RAILS_ENV value of the host machine
environment:
RAILS_ENV: $RAILS_ENV
# makes the app container aware of the DB container
links:
- db
# persist logs between containers by storing in a volume
volumes:
- myapp-logs:/var/www/myapp/log
# open webapp port for containers only
expose:
- '3000'
# service configuration for production web server (Nginx)
web:
# use the web server image pulled from Docker Hub
image: madeagency/myapp_web:$DEPLOY_TAG
# makes the web container aware of the app container
links:
- app
# makes the web container aware of the log volume setup by the app container
volumes_from:
- app
# expose on the host the port we configured Nginx to bind to
ports:
- "80:80"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment