-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildspec.yml
25 lines (25 loc) · 998 Bytes
/
buildspec.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
version: 0.2
phases:
install:
runtime-versions:
docker: 18
commands:
- apt-get -y update
- apt-get -y install jq
pre_build:
commands:
- echo "Starting docker daemon..."
- nohup /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://127.0.0.1:2375 --storage-driver=overlay2&
- timeout 15 sh -c "until docker info; do echo .; sleep 1; done"
- echo "Logging into Amazon ECR..."
- $(aws ecr get-login --no-include-email --region ${AWS_DEFAULT_REGION})
- TAG="$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | head -c 8)"
build:
commands:
- docker build -t "${REPOSITORY_URI}:latest" . -f Dockerfile
- docker tag "${REPOSITORY_URI}:latest" "${REPOSITORY_URI}:${TAG}"
post_build:
commands:
- docker push "${REPOSITORY_URI}:latest"
- docker push "${REPOSITORY_URI}:${TAG}"
- printf '{"Tag":"%s","RepositoryUri":"%s"}' $TAG $REPOSITORY_URI $PROJECT_NAME $ARTIFACT_BUCKET > build.json