version: '2'

volumes:
  laserrdb:
    external: true

services:

  db:
    env_file: .env
    image: redis:6-alpine
    volumes:
      - laserrdb:/var/lib/redis
    command: ["redis-server", "--appendonly", "yes"]


  app:
    env_file: .env
    build: ../
    image: teamlaser/laser-app:latest
    ports:
      - "5000:5000"
    depends_on:
      - db
    command: python /opt/server.py

  assets:
    env_file: .env
    image: teamlaser/laser-app:latest
    ports:
      - "8080:80"
    depends_on:
      - app
    command: nginx -g 'daemon off;error_log /dev/stdout info;'

  worker:
    env_file: .env
    image: teamlaser/laser-app:latest
    depends_on:
      - db
    command:  bash -c "while true; do python /opt/worker.py; sleep 3; done"

