version: '3'

services:
  payload:
    image: node:18-alpine
    pull_policy: always
    ports:
      - '3002:3000'
    volumes:
      - .:/home/node/app
      - node_modules:/home/node/app/node_modules
    working_dir: /home/node/app/
    command: sh -c "yarn install && yarn dev"
    environment:
      - NODE_ENV=production
      - DATABASE_URI=${DATABASE_URI}
      - PAYLOAD_SECRET=${PAYLOAD_SECRET}
      - NEXT_PUBLIC_SERVER_URL=${NEXT_PUBLIC_SERVER_URL}
      - CRON_SECRET=${CRON_SECRET}
      - PREVIEW_SECRET=${PREVIEW_SECRET}
      - PAYLOAD_DROP_DATABASE=false
      - PAYLOAD_SEED=false

volumes:
  node_modules: