Skip to content

Instantly share code, notes, and snippets.

@benbonnet
Created April 17, 2016 18:09
Show Gist options
  • Save benbonnet/c6f02fff984405eeca817f202d05a12b to your computer and use it in GitHub Desktop.
Save benbonnet/c6f02fff984405eeca817f202d05a12b to your computer and use it in GitHub Desktop.
db:
env_file: .env
# use the preferred version of the official Postgres image
# see https://hub.docker.com/_/postgres/
image: postgres:9.4.5
# persist the database between containers by storing it in a volume
volumes:
- deemx-postgres:/var/lib/postgresql/data
redis:
image: redis
ports:
- "6379"
cache:
image: memcached
app:
# use the Dockerfile next to this file
build: .
# 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
- redis
- cache
# expose the port we configured Unicorn to bind to
ports:
- "3000"
worker:
build: .
env_file: .env
command: bundle exec sidekiq #-C ./config/initializers/sidekiq.yml
environment:
SECRET_KEY_BASE: $SECRET_KEY_BASE
RAILS_ENV: $RAILS_ENV
links:
- db
- redis
- cache
web:
# set the build context to the root of the Rails app
build: .
# build with a different Dockerfile
dockerfile: config/containers/Dockerfile-nginx
# makes the web container aware of the app container
links:
- app
# expose 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