-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildspec.yml
34 lines (32 loc) · 1.11 KB
/
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
26
27
28
29
30
31
32
33
34
version: 0.2
phases:
install:
commands:
- 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"
pre_build:
commands:
- echo log in to Amazon ECR...
- aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username $ECR_LOGIN_USER --password-stdin $ECR_LOGIN_PASS
- REPOSITORY_URI=$REPO_URL
- IMAGE_TAG=${COMMIT_HASH:=latest}
build:
commands:
- echo Build started on `date`
- echo Building the Docker image.
- echo log in to Amazon ECR...
- aws --version
- docker build -t $REPO_NAME .
- docker tag $REPO_NAME:latest $REPOSITORY_URI:latest
post_build:
commands:
- echo Build completed on `date`
- docker push $REPOSITORY_URI:latest
- printf '[{"name":"main-service","imageUri":"%s"}]' $REPOSITORY_URI:latest > imagedefinitions.json
artifacts:
files: imagedefinitions.json
cache:
paths:
- '/root/.docker/cli-plugins'
- '/root/.npm/**/*'
- 'dist/**/*'