Github - Deploying a Nest.js App to AWS Elastic Beanstalk (Node.js Platform) with Github Actions
Steps
Push code to GitHub
Trigger GitHub Actions to
install dependencies
andbuild project
Deploy the project to AWS Elastic Beanstalk
Run script in Procfile
(npm run start:prod)
What do we need?
Procfile - Add
Procfile
to your Nest.js Application.ebignore - Add
.ebignore
to your Nest.js ApplicationPORT - Let your Nest.js Application listening port match to Elastic Beanstalk proxy forwarding port
GitHub Workflow files
Add Procfile
to the root of your Nest.js Application
Procfile
to the root of your Nest.js ApplicationAdd .ebignore
to the root of your Nest.js Application
.ebignore
to the root of your Nest.js ApplicationIf.ebignore
is present, the EB CLI doesn't read.gitignore
.
This file prevents dist
folder to be ignored when deploy.
Set Environment Variable PORT
to 8080
at Elastic Beanstalk - Config
PORT
to 8080
at Elastic Beanstalk - ConfigIf your application listening to process.env.PORT, then you can set Elastic Beanstalk Config PORT to any port. Otherwise, set your application listening port to 8080 to match the default proxy forwarding port.
GitHub Workflow files
PreviousGithub - Deploying a Nest.js App to AWS Elastic Beanstalk (Docker Platform) with Github ActionsNextUsing Fastlane to automate beta deployments and releases for your iOS and Android apps
Last updated
Was this helpful?