Skip to content

Instantly share code, notes, and snippets.

@rcdexta
Last active July 19, 2018 02:32
Show Gist options
  • Save rcdexta/e02bd83d251e7ddc0382cfa2d3454abc to your computer and use it in GitHub Desktop.
Save rcdexta/e02bd83d251e7ddc0382cfa2d3454abc to your computer and use it in GitHub Desktop.
version: 0.2
phases:
pre_build:
commands:
- IMAGE_TAG=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
- npm ci
- $(aws ecr get-login --region $AWS_DEFAULT_REGION)
build:
commands:
- echo Running tests
- npm run test
- echo Packaging application
- docker build -t $REPOSITORY_URI:latest .
- docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG
post_build:
commands:
- echo Pushing the Docker images...
- docker push $REPOSITORY_URI:$IMAGE_TAG
- echo Writing image definitions file...
- printf '[{"name":"expresso-staging","imageUri":"%s"}]' $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json
cache:
paths:
- ~/.npm
- /var/lib/docker/**/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment