This is an example how to configure Dockerrun.aws.json for running Spring Boot app in AWS Elastic Beanstalk. The application is generated with JHipster
- JDK 1.8
- Maven 3.0+
- Docker
- AWS account (don't worry, the stuff will be doing in this example is eligible for free tier, that is you don't need to pay for this)
- AWS EB CLI
- EB CLI
Build the maven project and Docker image
mvn clean package -Pprod docker:build
Run application locally with docker-compose
docker-compose -f src/main/docker/app.yml up
Stop docker-compose
type Ctrl+C
Tag build image to push to AWS repo URI
docker tag jhipsta-app:latest YOUR_AWS_ID.dkr.ecr.YOUR_AWS_REGION.amazonaws.com/jhipsta-app:latest
Get login command for AWS ECR
aws ecr get-login --region YOUR_AWS_REGION
This will generate docker login command that you need then to run
Push image to ECR
docker push YOUR_AWS_ID.dkr.ecr.YOUR_AWS_REGION.amazonaws.com/jhipsta-app:latest
Initialize AWS ElasticBeanstalk application
eb init
and go with defaults
Create environment
eb create
and go with defaults
Update Dockerrun.aws.json and deploy the app.
Run this from directory with Dockerrun.aws.json
eb deploy
Run application locally with EB CLI
eb local run
Please check my blog post on this