-
Notifications
You must be signed in to change notification settings - Fork 23
/
buildspec.yml
37 lines (35 loc) · 1.43 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
35
36
37
version: 0.2
env:
variables:
DOCKER_CLI_EXPERIMENTAL: enabled
DOCKER_HUB_USERNAME: _
DOCKER_HUB_PASSWORD: _
IMAGE_REPO_NAME: gcr.io/instana-agent-qa/instana-agent-operator
TARGETPLATFORM: _
ARCH: _
VERSION: _
COMMIT_SHA: _
phases:
build:
commands:
- export IMAGE_TAG="${COMMIT_SHA}-${VERSION}-${ARCH}"
- export DATE=`date`
- docker --version
- yum -y install qemu-user-static
- wget -nv https://github.com/docker/buildx/releases/download/v0.5.1/buildx-v0.5.1.linux-amd64
- chmod a+x buildx-v0.5.1.linux-amd64
- mkdir -p ~/.docker/cli-plugins
- mv buildx-v0.5.1.linux-amd64 ~/.docker/cli-plugins/docker-buildx
- echo Build started on `date` with tag `echo $IMAGE_TAG`
- echo "${IMAGE_TAG}" > tag
- docker buildx create --name rosetta
- docker buildx use rosetta
- docker buildx inspect --bootstrap
- echo "$DOCKER_HUB_PASSWORD" | docker login -u $DOCKER_HUB_USERNAME --password-stdin https://index.docker.io/v1/
- docker buildx build -f Dockerfile --load --platform ${TARGETPLATFORM} --build-arg "TARGETPLATFORM=${TARGETPLATFORM}" --build-arg VERSION=${VERSION} --build-arg GIT_COMMIT=${COMMIT_SHA} --build-arg BUILD=${COMMIT_SHA} --build-arg DATE="${DATE}" -t "${IMAGE_REPO_NAME}:${IMAGE_TAG}" .
- docker save "${IMAGE_REPO_NAME}:${IMAGE_TAG}" > image.tar
artifacts:
name: ${IMAGE_TAG}
files:
- 'tag'
- 'image.tar'