We currently use AWS CodePipeline/CodeBuild to build our Typescript application and then deploy it to Elastic Beanstalk. The process is currently:
CodePipeline:
- Source – Fetch code from GitHub
- Build – Install NPM packages and build/transpile code
- Deploy – Deploy to Elastic Beanstalk using the EB action provider
- Migrate – Again install NPM packages and build code + execute our database migration scripts
Elastic Beanstalk:
During the Deploy step, I think that EB again builds the code because it creates a new Docker image (based on the app’s Dockerfile), and then deploys that image.
I’m also under the impression that every time EB scales-out, it again rebuilds the Docker image during the deployment process.
This is all very slow, and I’d love to change it to this:
- Source – Fetch code from GitHub
- Build – Build by creating a Docker image
- Deploy – Deploy the image to Elastic Beanstalk
- Migrate – Start the Docker image + execute our database migration scripts
Elastic Beanstalk:
Simply start the already built Docker image when deploying or scaling-out.
Is this scenario possible? Can anyone provide me with tips/references on how to achieve this?