1 Answer
- Newest
- Most votes
- Most comments
0
To deploy a Next.js 13 app using CI/CD on AWS Amplify Hosting, you need to follow these steps:
- Create a Next.js app using Create Next App [1].
- Initialize Amplify in your project and add any backend features using Amplify CLI [1].
- Add hosting to your project and choose Continuous deployment as the hosting type[2,1].
- Connect your app to a Git provider such as GitHub, GitLab or Bitbucket using Amplify Console[2,3].
- Configure your build settings and environment variables using amplify.yml file[1].
- Push your code changes to your Git branch and watch Amplify Console build and deploy them to your web app[2,3].
Do you have any questions about these steps? A sample amplify.yml file for a Next.js 13 app is as follows:
version: 1
frontend:
phases:
preBuild:
commands:
- yarn install
build:
commands:
- yarn build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- node_modules/**/*
[1] https://docs.amplify.aws/guides/hosting/nextjs/q/platform/js/
[2]https://docs.amplify.aws/start/getting-started/hosting/q/integration/next/
[3]https://aws.amazon.com/blogs/mobile/host-a-next-js-ssr-app-with-real-time-data-on-aws-amplify/
answered a year ago
Relevant content
- asked a year ago
- asked 4 months ago
- asked a month ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 7 months ago
Thanks Raheel for your response, Yes that flow already works just fine. No problems there. The issue we have is wanting to decouple from Amplify Console git push based builds and use 'amplify cli publish' to selectively build artefact and push to amplify. We already do this for none-nextjs apps with no problem but for nextjs 13 the only way to have success currently is the git based approach that we want to avoid, Our mono repo has many 10s of MFEs that we would not want to trigger a build/deploy for every single one of, with each PR merge plus more often than not our merge and release happen quite separately to each other.