Skip to content

Instantly share code, notes, and snippets.

@channainfo
Last active January 2, 2020 03:15
Show Gist options
  • Save channainfo/e1ef3e45904d0e1fbebf906c1f2b3f70 to your computer and use it in GitHub Desktop.
Save channainfo/e1ef3e45904d0e1fbebf906c1f2b3f70 to your computer and use it in GitHub Desktop.
docker compose for rails app
version: '3'
services:
memcached:
image: memcached:1.5-alpine
volumes:
- memcache:/data
db:
image: mysql:5.7
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
volumes:
- db:/var/lib/mysql
redis:
image: redis
volumes:
- redis:/data
web:
build:
context: .
dockerfile: Dockerfile
command: bash -c "rm -f shared/pids/puma.pid && bundle exec rails s -b '0.0.0.0'"
volumes:
- .:/home/app/avocado
- bundle:/usr/local/bundle
tmpfs: /home/app/avocado/tmp
ports:
- "3000:3000"
depends_on:
- db
- redis
- memcached
environment: &sys_rails_env
RAILS_ENV: 'development'
REDIS_URL: 'redis://redis:6379/12'
DATABASE_HOST: 'db'
DATABASE_NAME_DEVELOPMENT: 'avocado_docker_dev'
MEMCACHED_SERVER: 'memcached:11211'
ASSET_HOST_URL: 'http://localhost'
HOST: 'http://localhost'
sidekiq:
build:
context: .
dockerfile: Dockerfile
command: bundle exec sidekiq -C config/sidekiq.yml
depends_on:
- db
- redis
- memcached
environment:
<<: *sys_rails_env
volumes:
db:
redis:
bundle:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment