version: '3.8'

services:
  backend:
    build:
      context: .
      target: backend
    #restart: always
    ports:
      - "8000:8000"
    env_file:
      - .env
  
  worker:
    build:
      context: .
      target: worker
    restart: always
    env_file:
      - .env
  
  websocket:
    build:
      context: .
      target: websocket
    restart: always
    ports:
      - "8001:8001"
    env_file:
      - .env

  db:
    image: postgres:15-alpine
    restart: always
    ports:
      - "5432:5432"
    env_file:
      - .env
    environment:
      - POSTGRES_PASSWORD=${DB_PASSWORD}
      - POSTGRES_USER=${DB_USER}
      - POSTGRES_DB=${DB_NAME}
    volumes:
      - db:/var/lib/postgresql/data
  
  cache:
    image: redis:7-alpine
    restart: always
    ports:
      - "6379:6379"
    command: redis-server --save 60 1 --loglevel warning
    volumes:
      - cache:/data
  
  s3:
    image: quay.io/minio/minio
    restart: always
    ports:
      - "9000:9000"
      - "9001:9001"
    env_file:
      - .env
    environment:
      - MINIO_ROOT_USER=${S3_ROOT_USER}
      - MINIO_ROOT_PASSWORD=${S3_ROOT_PASSWORD}
      #- MINIO_SCHEME=http
    volumes:
      - s3:/data
    command: server /data --console-address ":9001"

volumes:
  db:
  s3:
  cache:
