version: '2'

services:
  postgres:
    image: 'postgres:9.6-alpine'
    environment:
      POSTGRES_USER: 'app_perf'
      POSTGRES_PASSWORD: 'password'
    ports:
      - '6543:5432'
    volumes:
      - 'postgres:/var/lib/postgresql/data'

  redis:
    image: 'redis:3.2-alpine'
    command: redis-server
    ports:
      - '5268:6379'
    volumes:
      - 'redis:/data'

  website:
    depends_on:
      - 'postgres'
      - 'redis'
    build:
      context: .
      dockerfile: Dockerfile.dev
    ports:
      - '5000:5000'
    volumes:
      - '.:/app'
    env_file:
      - '.env.docker'
    links:
      - 'postgres'

  agent:
    depends_on:
      - 'website'
    build: .
    command: bundle exec app_perf_agent --host website:5000 --license-key e47a7331-77cd-4ea0-8be1-b4130255a3a8 -f

volumes:
  redis:
  postgres:

version: '3.7'

networks:
  app_perf:

x-base: &base
  build:
    context: .
    dockerfile: Dockerfile.dev
  command: irb
  networks:
    - app_perf
  volumes:
    - '.:/app'
  env_file:
    - '.env.docker'
  depends_on:
    - 'postgres'
    - 'redis'

services:
  postgres:
    image: 'postgres:9.6-alpine'
    environment:
      POSTGRES_USER: 'app_perf'
      POSTGRES_PASSWORD: 'password'
    ports:
      - '6543:5432'
    volumes:
      - 'postgres:/var/lib/postgresql/data'
    networks:
      - app_perf

  redis:
    image: 'redis:5.0.7-alpine'
    command: redis-server
    ports:
      - '5268:6379'
    volumes:
      - 'redis:/data'
    networks:
      - app_perf

  website:
    <<: *base
    command: bundle exec rails s -p 5000
    ports:
      - '5000:5000'

  worker:
    <<: *base
    command: bundle exec sidekiq -C config/sidekiq.yml

  agent:
    <<: *base
    command: bundle exec app_perf_agent --host website:5000 --license-key e47a7331-77cd-4ea0-8be1-b4130255a3a8 -f
    depends_on:
      - 'website'

volumes:
  redis:
  postgres:

Update docker compose - update syntax to 3.7 - use network instead of link - use shared build based on the same Dockerfile - add worker service - use a more recent version of Redis for compatibility with the version of Sidekiq in use
Update docker compose
- update syntax to 3.7
- use network instead of link
- use shared build based on the same Dockerfile
- add worker service
- use a more recent version of Redis for compatibility with the version of Sidekiq in use
