A simple Node JS application with unit tests and coverage reports using mocha and istanbul. It also does a docker build once CI passes and then pushes the image to Amazon EC2 Container Registry
To run this example successfully, you must first perform some setup steps to customize shippable.yml to point to your ECR and ECS accounts.
In order to allow Shippable to connect to your AWS services, you need to add an integration through the Shippable UI. This integration will be referenced in the YAML as needed.
Log in to Shippable and follow instructions in the docs to create an AWS keys integration. Note down the name of the integration you created.
Fork this repository to your account.
All configuration is stored in the shippable.yml file at the root of this repository. You will need to make the following updates to customize the standard YAML included with this example:
- Change ECR_REPO (line 19) to point to your ECR repo. Please make sure the repo already exists on ECR.
- Update the
integrationName
(47) in the integration.hub section with the name of your AWS integration. - Under
resources
, update the deploy-ecs-basic-image resource with the following:integration
should point to your AWS integration namesourceName
should point to the ECR repo
- Under
resources
, update the deploy-ecs-basic-ecs-cluster resource with the following:integration
should point to your AWS integration namesourceName
should point to your ECS cluster name. Please make sure the cluster already exists.region
should point to the region of your ECS cluster.
Commit your changes to source control.
- Enable your project for CI on Shippable
- Commit a small change to your repository (add a space or character in readme file). This will automatically trigger a build on Shippable. You can also trigger a manual build through the Shippable UI.
- The build will build your Docker image and push it to ECR.
- Next, you need to enable config to deploy your Docker container to ECS. This logic is contained in the
jobs
andresources
sections of your YAML, which is known as Assembly Line config in Shippable. - Add your Assembly Line. This will ensure that your
jobs
andresources
sections are read. - Rerun your CI job with another commit to the repository or with a manual build. The workflow should now trigger end to end and your container should be deployed to ECS.