cc-core-cli
Version:
Command Line Interface tool for generating project templates for the (Your Platform's Name) platform.
30 lines (28 loc) • 1.12 kB
YAML
version: 0.2
phases:
pre_build:
commands:
- echo Logging in to Amazon ECR...
- $(aws ecr get-login --no-include-email --region ap-southeast-1)
- REPOSITORY_URI=$ECR_URI
- COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
- IMAGE_TAG=${COMMIT_HASH:=latest}
build:
commands:
- echo logging in dockerhub...
- docker login -u $dockeruser -p $dockerpassword
- echo Build started on `date`
- echo Building the Docker image...
- sed -i "s|{{SHOPSTACK_TOKEN}}|$SHOPSATCK_TOKEN|g" .npmrc
- cat .npmrc
- docker build --no-cache -t $REPOSITORY_URI:latest --build-arg commit_hash=$COMMIT_HASH .
- docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG
post_build:
commands:
- echo Build completed on `date`
- echo Pushing the Docker image...
- docker push $REPOSITORY_URI:$IMAGE_TAG
- echo Writing image definitions file...
- printf '[{"name":"%s","imageUri":"%s"}]' $IMAGE_CONTAINER_NAME $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json
artifacts:
files: imagedefinitions.json