/aws-docker-deploy

Scripts and templates for deploying docker containers to aws / elastic beanstalk

Primary LanguageShellMIT LicenseMIT

aws-docker-deploy

Scripts and templates for deploying docker containers to aws / elastic beanstalk ("Single Container" style with v1 Dockerrun.aws.json).

The script does the following

  • Builds the docker image
  • Uploads the docker image to ECR
  • Creates and uploads new beanstalk application version to S3
  • Deploys new beanstalk version to target environment

The docker image is tagged with <branch name>-<commit hash>-<timestamp> which is also used as the beanstalk application version.

Create a project specific deploy script like the following

# e.g. (optional) project-specific build script to prepare artifacts needed by Dockerfile 
./build.sh

# project-specific environment variables
NAME=container-name
AWS_ACCOUNT_ID=1234567890
AWS_REGION=us-east-1
EB_BUCKET=elasticbeanstalk-us-east-1-1234567890 
EB_APP_NAME="EB App Name"
# optional beanstalk environment name; if omitted then no environment update command will be sent
EB_ENV_NAME=eb-env-name
CONTAINER_PORT=80

# download and execute deploy.sh in the current shell
eval "$(curl -s -L https://raw.githubusercontent.com/imperfectproduce/aws-docker-deploy/64aa6aecad4dbc04fad89f5982e6ac810a8743e9/deploy.sh)"

Note the revision specific curl sources, see https://help.github.com/articles/getting-permanent-links-to-files/

Credit to Yefim Vedernikoff for original inspiration / code reference.