Jared Siebert

Joined

3,710 Experience
37 Lessons Completed
0 Questions Solved

Activity

Posted in Docker Basics for Rails Discussion

Second this! Probably needs to be tweaked but here's my docker-compose.yml that currently works for local dev with sidekiq

services:
  postgres:
    image: postgres:10.4-alpine
    env_file:
      - ./env/common.env
      - ./env/dev.env
    ports:
      - 5432:5432
    volumes:
      - postgres:/var/lib/postgresql/data

  redis:
    image: redis:4.0-alpine
    ports:
      - 6379:6379
    volumes:
      - redis:/data

  app: &app_base
    build:
      context: .
      args:
        - BUNDLE_WITHOUT=production
    env_file:
      - ./env/common.env
      - ./env/dev.env
    command: bundle exec puma -C config/puma.rb
    ports:
      - 3000:3000
    volumes:
      - .:/app
    depends_on:
      - postgres
      - redis
    stdin_open: true
    tty: true

  sidekiq:
    <<: *app_base
    command: bundle exec sidekiq -C config/sidekiq.yml
    ports: []
    stdin_open: false
    tty: false

volumes:
  redis:
  postgres:

Note - in the docker file you can't have the last 2 lines of the tutorial triggering rails s