-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildspec.yml
32 lines (31 loc) · 1.57 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
version: 0.2
phases:
install:
commands:
- docker version
- curl -JLO https://github.com/docker/buildx/releases/download/v0.9.1/buildx-v0.9.1.linux-amd64
- mkdir -p ~/.docker/cli-plugins
- mv buildx-v0.9.1.linux-amd64 ~/.docker/cli-plugins/docker-buildx
- chmod a+rx ~/.docker/cli-plugins/docker-buildx
- docker run --privileged --rm tonistiigi/binfmt --install all
pre_build:
commands:
- REPO_BASE=973098863180.dkr.ecr.ap-southeast-2.amazonaws.com
- REPO_NAME=core-website
- TAG=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | head -c 8)
- aws ecr get-login-password --region ap-southeast-2 | docker login --username AWS --password-stdin "$REPO_BASE"
build:
commands:
- echo Build started on `date`
- echo Building the Docker image...
- docker buildx create --use --name customDriver
- docker buildx build --push --platform linux/arm64/v8 -t "$REPO_BASE/$REPO_NAME:latest" . -f Dockerfile.Prod
- docker buildx build --load --platform linux/arm64/v8 -t "$REPO_BASE/$REPO_NAME:latest" . -f Dockerfile.Prod
- docker tag "$REPO_BASE/$REPO_NAME:latest" "$REPO_BASE/$REPO_NAME:$TAG"
post_build:
commands:
- docker push --all-tags "$REPO_BASE/$REPO_NAME"
- printf [{\"name\":\"$REPO_NAME\"\,\"imageUri\":\"973098863180.dkr.ecr.ap-southeast-2.amazonaws.com/$REPO_NAME:$TAG\"}] > imagedefinitions.json
artifacts:
files:
- imagedefinitions.json