version: '3'

services:
  payload:
    image: node:18-alpine
    ports:
      - '3000:3000'
    volumes:
      - .:/home/node/app
      - node_modules:/home/node/app/node_modules
    working_dir: /home/node/app/
    command: sh -c "yarn install && yarn dev"
    depends_on:
      - portfolio-db
    environment:
      - DATABASE_URL=postgresql://postgres:TrojanHero1@portfolio-portfoliodb-22lpk0:5432/postgres
      - PAYLOAD_DATABASE_ADAPTER=postgres
      - PAYLOAD_SECRET=n8Kj2vR5pL9mQx7tY3wE6bZ1aD4sF0hU9cV2xB5nM8pL1q

  portfolio-db:
    image: postgres:18
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: TrojanHero1
      POSTGRES_DB: postgres
    volumes:
      - pgdata:/var/lib/postgresql/data

volumes:
  pgdata:
  node_modules: