Next.Js Amplify deployment

7/9/2023, Published in Medium, DevTo and HashNode

Set up Amplify build and deploy configuration

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - npm ci
    build:
      commands:
        - env | grep -e SPOTIFY_CLIENT_ID -e SPOTIFY_CLIENT_SECRET -e SPOTIFY_REFRESH_TOKEN -e OPENSEARCH_API_KEY >> .env.production
        - env | grep -e NEXT_PUBLIC_ >> .env.production
        - npm run build
  artifacts:
    baseDirectory: .next
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

ALL SYSTEMS ONLINE