version: '3.9'

services:
  db:
    image: postgres:latest
    environment:
      POSTGRES_DB: lesson_1
      POSTGRES_PASSWORD: postgres
      POSTGRES_USER: postgres
    ports:
      - 5434:5432

  client:
    build:
      context: ./website/client
    container_name: lesson-001-client
    depends_on:
      - server
      - db
    environment:
      REACT_APP_WEBSITE_NAME: Social
      REACT_APP_BACKEND_HOST: localhost
      REACT_APP_BACKEND_PORT: 8080
      REACT_APP_CODESPACE_NAME: ${CODESPACE_NAME}
      REACT_APP_GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN: ${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}
    ports:
      - 3000:3000

  server:
    build:
      context: ./website/server
    depends_on:
      - db
    environment:
      PORT: 8080
      POSTGRES_DB: lesson_1
      POSTGRES_PASSWORD: postgres
      POSTGRES_USER: postgres
      POSTGRES_PORT: 5432
      POSTGRES_HOST: db
    links:
      - db
    ports:
      - "8080:8080"
    container_name: lesson-001-server