version: "3.7"

x-env: &env
  REDIS_URL: redis://redis
  GLOWFIC_DATABASE_HOST: postgres
  GLOWFIC_DATABASE_USER: postgres
  GLOWFIC_DATABASE_PASS: postgres
x-svc: &svc
  build: .
  image: glowfic
  links:
    - redis
    - postgres
  volumes:
    - .:/code
    - bundler-volume:/usr/local/bundle

services:
  web:
    <<: *svc
    ports:
      - "3000:3000"
    command: bin/rails s
    environment:
      <<: *env
      BIND_HOST: 0.0.0.0
  worker:
    <<: *svc
    command: bundle exec rake resque:work
    environment:
      <<: *env
      TERM_CHILD: 1
      RESQUE_TERM_TIMEOUT: 7
      QUEUES: mailer,notifier,high,*
  redis:
    image: redis:4.0-alpine
  postgres:
    environment:
      - POSTGRES_PASSWORD=postgres
    image: postgres:11-alpine
    volumes:
      - "./db/storage/:/var/lib/postgresql/data"

volumes:
  bundler-volume:

version: "3.7"

x-env: &env
  REDIS_URL: redis://redis
  GLOWFIC_DATABASE_HOST: postgres
  GLOWFIC_DATABASE_USER: postgres
  GLOWFIC_DATABASE_PASS: postgres
x-svc: &svc
  build: .
  image: glowfic
  links:
    - redis
    - postgres
  volumes:
    - .:/code
    - bundler-volume:/usr/local/bundle

services:
  web:
    <<: *svc
    ports:
      - "3000:3000"
    command: bin/rails s
    environment:
      <<: *env
      BIND_HOST: 0.0.0.0
  worker:
    <<: *svc
    command: bundle exec rake resque:work
    environment:
      <<: *env
      TERM_CHILD: 1
      RESQUE_TERM_TIMEOUT: 7
      QUEUES: mailer,notifier,high,*
  redis:
    image: redis:4.0-alpine
  postgres:
    environment:
      - POSTGRES_PASSWORD=postgres
    image: postgres:11-alpine
    volumes:
      - postgres-data:/var/lib/postgresql/data

volumes:
  bundler-volume:
  postgres-data:

Use a virtual volume for Postgres Docker data
Use a virtual volume for Postgres Docker data
