version: '3.9'
services:
  frontend:
    image: 'nginx:1.23.4-alpine'
    ports:
      - '3000:80'
      - '3002:81'
    volumes:
      - ${PWD}/../frontend/dist:/frontend
      - ${PWD}/../landing-page/out:/landing-page
      - ${PWD}/nginx.test.conf:/etc/nginx/conf.d/default.conf
  backend:
    image: 035363416972.dkr.ecr.us-east-1.amazonaws.com/wavtool-server:${SERVER_TAG}
    ports:
      - '3001:3001'
    depends_on:
      - postgres
      - redis
      - frontend
    environment:
      - SERVER_URI=http://localhost:3001
      - APP_URI=http://localhost:3000
      - LANDING_URI=http://localhost:3002
      - URL_SHORTENER_PREFIX=http://localhost:3001/s
      - COOKIE_DOMAIN=localhost
      - DATABASE_USER=postgres
      - DATABASE_HOST=postgres
      - DATABASE_NAME=wavtool_test
      - DATABASE_PASSWORD=postgres
      - DATABASE_PORT=5432
      - PGSSLMODE=disable
      - ENVIRONMENT=development
      - GITHUB_CLIENT_ID=12345
      - GITHUB_CLIENT_SECRET=12345
      - GITHUB_REDIRECT_URI=https://wavtool.com/auth/github/callback
      - GOOGLE_CLIENT_ID=12345
      - GOOGLE_CLIENT_SECRET=12345
      - GOOGLE_REDIRECT_URI=https://wavtool.com/oauth2/redirect/google
      - FACEBOOK_APP_ID=1234
      - FACEBOOK_APP_SECRET=12345
      - FACEBOOK_REDIRECT_URI=https://wavtool.com/oauth2/redirect/facebook
      - OPENAI_API_KEY=secret-goes-here
      - SHUTDOWN_TIMEOUT=5
      - SESSION_PROVIDER=redis
      - REDIS_HOST=redis
      - REDIS_PORT=6379
  postgres:
    image: 035363416972.dkr.ecr.us-east-1.amazonaws.com/postgres-pgvector:14.9
    ports:
      - '5432:5432'
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - PGPASSWORD=postgres
    volumes:
      - ${PWD}/test-database.sql:/docker-entrypoint-initdb.d/test-database.sql
  redis:
    image: 'redis:7.0-alpine'
    ports:
      - '6379:6379'
