version: '2' services: rails: image: ruby:2.3 # build: # context: . # dockerfile: docker/rails.Dockerfile # We'll specify a dotenv file for docker-compose to load more environment # variables into our app containers. This dotenv file would normally contain # sensitive data (API keys & secrets, etc) which SHOULD NOT be committed into # Git. # Keep in mind that any changes in this file will require a container restart # in order to be available on the app containers: env_file: - dev.env # Specify environment variables available for our app containers. We'll leave # a YML anchor in case we need to override or add more variables if needed on # each app container: environment: &app_environment # We'll overwrite the PATH environment variable to include the 'bin/' # directory, for the entrypoint script to find the app's executables: PATH: /usr/src/app/bin:/usr/local/bundle/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin # We'll set the REDIS_URL environment variable for the app to connect # to our redis container: REDIS_URL: redis://redis:6379 DATABASE_URL: postgresql://postgres:3x4mpl3@postgres:5432/rails_example_dev # We'll set the RAILS_ENV and RACK_ENV environment variables to # 'development', so our app containers will start in 'development' mode # on this compose project: RAILS_ENV: development RACK_ENV: development cpu_shares: 4 # Specify the directory from where all commands sent to the container will be # issued to where the code is mounted: working_dir: /usr/src/app # Keep the stdin open, so we can attach to our app container's process # and do things such as byebug, etc: stdin_open: true # Enable sending signals (CTRL+C, CTRL+P + CTRL+Q) into the container: tty: true volumes: # Mount our app code directory (".") into our app containers at the # "/usr/src/app" folder: - .:/usr/src/app # Mount the 'gems' volume on the folder that stores bundled gems: - gems:/usr/local/bundle