version: '3.9'

services:
  db:
    container_name: postgres-db
    image: postgres:14
    environment:
      POSTGRES_USER: "postgres"
      POSTGRES_PASSWORD: "pwd"
      POSTGRES_DB: "users_db"
    ports:
      - '5432:5432'
    volumes:
      - users-database:/var/lib/postgresql/data
      - ./public/init_data:/docker-entrypoint-initdb.d
  web:
    container_name: node-web-interface
    image: node:lts
    user: 'node'
    working_dir: /home/node/app
    environment:
      NODE_ENV: development
      SESSION_SECRET: "super duper secret!"
      API_KEY: "ZjGXIfaEG1G4OkSHyB5wvqOQ5BPb9iav"
    depends_on:
      - db
    ports:
      - '3000:3000'
    volumes:
      - .:/home/node/app  # Mount Client directory
      - ./node_modules:/home/node/app/node_modules  # Mount node_modules directory
    command: 'npm run start'

volumes:
  users-database:
