From 2c2001304f1d63790d6da98cb835b43f7ce64987 Mon Sep 17 00:00:00 2001 From: Glen Robson Date: Tue, 4 Jun 2019 23:52:20 -0700 Subject: [PATCH] Configuring AWS deploy --- buildspec.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 buildspec.yml diff --git a/buildspec.yml b/buildspec.yml new file mode 100644 index 00000000..7fd44a39 --- /dev/null +++ b/buildspec.yml @@ -0,0 +1,33 @@ +version: 0.2 + +phases: + install: + runtime-versions: + docker: 18 + commands: + - nohup /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay& + - timeout 15 sh -c "until docker info; do echo .; sleep 1; done" + pre_build: + commands: + - echo Logging in to Amazon ECR... + - aws --version + - $(aws ecr get-login --region $AWS_DEFAULT_REGION --no-include-email) + - IMAGE_NAME="SAS" + - REPOSITORY_URI=082101253860.dkr.ecr.eu-west-2.amazonaws.com/simple_annotation_server + - IMAGE_TAG=prod_$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7) + build: + commands: + - echo Build started on `date` + - echo Building the Docker image... + - echo Image_tag $IMAGE_TAG + - docker build -t $REPOSITORY_URI:latest . + - docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG + post_build: + commands: + - echo Build completed on `date` + - echo Pushing the Docker images... + - docker push $REPOSITORY_URI:$IMAGE_TAG + - echo Writing image definitions file... + - printf '[{"name":"eventsContainer","imageUri":"%s"}]' $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json +artifacts: + files: imagedefinitions.json