version: "3.4"

services:
  scylladb:
    image: scylladb/scylla:4.1.0
    command: --smp 1 --memory 1G
    ports:
      - 9042:9042
    volumes:
      - ./docker-data/scylladb:/var/lib/scylla

  rabbitmq:
    image: library/rabbitmq:3.8.9-management-alpine
    ports:
      - 15672:15672
    environment:
      RABBITMQ_DEFAULT_USER: admin
      RABBITMQ_DEFAULT_PASS: admin

  node:
    image: twaketech/twake-node:latest
    environment:
      - NODE_ENV=production
    volumes:
      - ./configuration/backend-node/production.json:/usr/src/app/config/production.json
    depends_on:
      - scylladb
      - rabbitmq
    links:
      - scylladb

  php:
    image: twaketech/twake-php:latest
    environment:
      - DEV=production
    volumes:
      - ./configuration/backend/Parameters.php:/configuration/Parameters.php
      - ./connectors/:/twake-core/src/BuiltInConnectors/Connectors
      - ./docker-data/drive/:/twake-core/drive/
      - ./docker-data/fpm/:/etc/docker-data/fpm/
      - ./docker-data/drive-preview/:/twake-core/web/medias/
      - ./docker-data/uploads/:/twake-core/web/upload/
    depends_on:
      - scylladb
      - rabbitmq
    links:
      - scylladb

  nginx:
    image: twaketech/twake-nginx:latest
    environment:
      - DEV=production
    ports:
      - 8000:80
    depends_on:
      - php
      - node
    volumes_from:
      - php
      - node
    volumes:
      - ./docker-data/logs/nginx/:/var/log/nginx
      - ./docker-data/letsencrypt/:/etc/letsencrypt/
      - ./docker-data/drive-preview/:/twake-core/web/medias/
      - ./docker-data/uploads/:/twake-core/web/upload/
