services:
  web:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: deafgain-website-web-1
    ports:
      - "804:804"
    depends_on:
      - api
      - redis
    environment:
      - NODE_ENV=production
    restart: unless-stopped
    volumes:
      - /docker/websites/deafgain/video_content:/usr/share/nginx/html/videos
      - /docker/websites/deafgain/logs:/var/log/nginx/deafgain-website
    networks:
      - caddy_network
      - default

  api:
    build:
      context: .
      dockerfile: Dockerfile.api
    container_name: deafgain-website-api-1
    depends_on:
      - redis
    environment:
      - NODE_ENV=production
      - PORT=3000
      - SMTP_HOST=${SMTP_HOST}
      - SMTP_PORT=${SMTP_PORT}
      - SMTP_SECURE=${SMTP_SECURE}
      - GOOGLE_EMAIL=${GOOGLE_EMAIL}
      - GOOGLE_APP_PASSWORD=${GOOGLE_APP_PASSWORD}
      - RECIPIENT_EMAIL=${RECIPIENT_EMAIL}
      - REDIS_URL=redis://redis:6379
      - REDIS_TOKEN=${REDIS_TOKEN}
    restart: unless-stopped
    networks:
      - default

  redis:
    image: redis:7-alpine
    container_name: deafgain-website-redis-1
    restart: unless-stopped
    volumes:
      - redis_data:/data
    networks:
      - default

volumes:
  redis_data:

networks:
  caddy_network:
    external: true
