-
Notifications
You must be signed in to change notification settings - Fork 2
/
.azure-pipelines.yml
42 lines (35 loc) · 1.48 KB
/
.azure-pipelines.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
38
39
40
41
42
variables:
BUILDX_VER: 'v0.7.1'
trigger:
- master
pool:
vmImage: ubuntu-latest
steps:
- script: |
mkdir -vp ~/.docker/cli-plugins/ ~/dockercache
curl --silent -L "https://github.com/docker/buildx/releases/download/${BUILDX_VER}/buildx-$(BUILDX_VER).linux-amd64" > ~/.docker/cli-plugins/docker-buildx
chmod a+x ~/.docker/cli-plugins/docker-buildx
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx create --name builder --driver docker-container --use
docker buildx inspect --bootstrap
displayName: 'setup buildx'
- script: |
echo $(DOCKER_PASSWORD) | docker login -u "$(DOCKER_USERNAME)" --password-stdin
displayName: 'docker login'
- script: |
VERSION=$(cat ./VERSION)
VERSIONARRAY=(`echo $VERSION | tr '.' ' '`)
GITHASH=$(git rev-parse --short HEAD)
docker buildx build \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg VCS_REF=${GITHASH} \
--build-arg VERSION=${VERSION} \
--platform linux/amd64,linux/arm64 \
-t $(DOCKER_REPOSITORIE):latest \
-t $(DOCKER_REPOSITORIE):v.${VERSIONARRAY[0]}.${VERSIONARRAY[1]}.${VERSIONARRAY[2]} \
-t $(DOCKER_REPOSITORIE):v.${VERSIONARRAY[0]}.${VERSIONARRAY[1]} \
-t $(DOCKER_REPOSITORIE):v.${VERSIONARRAY[0]} \
--push \
--file=scr/InternetSpeedMonitor/Dockerfile \
scr/InternetSpeedMonitor/.
displayName: 'docker buildx & push'