-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
150 lines (150 loc) · 5.39 KB
/
.gitlab-ci.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
stages:
- build
- test
- deploy
- buildx
- manifest
services:
- docker:19.03-dind
variables:
IMAGEINT: reg.mediabutler.app/mediabutler/linux-cli-utility
IMAGEEXT: mediabutler/linux-cli-utility
TAG: (if [ "${CI_COMMIT_TAG}" == "" ]; then "latest"; else ${CI_COMMIT_TAG}; fi);
DOCKER_CLI_EXPERIMENTAL: enabled
DOCKER_BUILDKIT: 1
DOCKER_TLS_CERTDIR: "/certs"
deploy_docker_int_amd64:
stage: deploy
before_script:
- docker login -u "gitlab-ci-token" -p $CI_JOB_TOKEN reg.mediabutler.app
script:
- docker build -t ${IMAGEINT}:amd64-${CI_COMMIT_REF_NAME} .
- docker push ${IMAGEINT}:amd64-${CI_COMMIT_REF_NAME}
deploy_docker_int_arm32v6:
stage: deploy
before_script:
- docker login -u "gitlab-ci-token" -p $CI_JOB_TOKEN reg.mediabutler.app
script:
- docker build --build-arg IMAGE_ARCH=arm32v6 -t ${IMAGEINT}:arm32v6-${CI_COMMIT_REF_NAME} .
- docker push ${IMAGEINT}:arm32v6-${CI_COMMIT_REF_NAME}
deploy_docker_int_arm32v7:
stage: deploy
before_script:
- docker login -u "gitlab-ci-token" -p $CI_JOB_TOKEN reg.mediabutler.app
script:
- docker build --build-arg IMAGE_ARCH=arm32v7 -t ${IMAGEINT}:arm32v7-${CI_COMMIT_REF_NAME} .
- docker push ${IMAGEINT}:arm32v7-${CI_COMMIT_REF_NAME}
deploy_docker_int_arm64v8:
stage: deploy
before_script:
- docker login -u "gitlab-ci-token" -p $CI_JOB_TOKEN reg.mediabutler.app
script:
- docker build --build-arg IMAGE_ARCH=arm64v8 -t ${IMAGEINT}:arm64v8-${CI_COMMIT_REF_NAME} .
- docker push ${IMAGEINT}:arm64v8-${CI_COMMIT_REF_NAME}
deploy_docker_int_i386:
stage: deploy
before_script:
- docker login -u "gitlab-ci-token" -p $CI_JOB_TOKEN reg.mediabutler.app
script:
- docker build --build-arg IMAGE_ARCH=i386 -t ${IMAGEINT}:i386-${CI_COMMIT_REF_NAME} .
- docker push ${IMAGEINT}:i386-${CI_COMMIT_REF_NAME}
buildx:
image: docker:19.03-git
stage: buildx
variables:
GIT_STRATEGY: none
artifacts:
paths:
- buildx
expire_in: 1 hour
services:
- docker:19.03-dind
script:
- export DOCKER_BUILDKIT=1
- git clone git://github.com/docker/buildx ./docker-buildx
- docker build --platform=local -o . ./docker-buildx
manifest_int:
stage: manifest
image: docker:19.03.8
services:
- name: docker:19.03-dind
command: ["--experimental"]
before_script:
- export DOCKER_BUILDKIT=1 DOCKER_CLI_EXPERIMENTAL=enabled
- docker info
- docker version
- mkdir -p ~/.docker/cli-plugins
- mv buildx ~/.docker/cli-plugins/docker-buildx
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- docker login -u "gitlab-ci-token" -p $CI_JOB_TOKEN reg.mediabutler.app
script:
- docker buildx install
- docker buildx create --name buildbot --use buildbot
- docker buildx inspect --bootstrap
- docker buildx ls
# - docker buildx create --use builder
- docker buildx build --progress plain --platform linux/amd64,linux/arm64,linux/386,linux/arm/v7,linux/arm/v6 .
deploy_docker_ext_amd64:
stage: deploy
before_script:
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD docker.io
script:
- docker build -t ${IMAGEEXT}:amd64-latest .
- docker push ${IMAGEEXT}:amd64-latest
only:
- master
deploy_docker_ext_arm32v6:
stage: deploy
before_script:
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD docker.io
script:
- docker build --build-arg IMAGE_ARCH=arm32v6 -t ${IMAGEEXT}:arm32v6-latest .
- docker push ${IMAGEEXT}:arm32v6-latest
only:
- master
deploy_docker_ext_arm32v7:
stage: deploy
before_script:
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD docker.io
script:
- docker build --build-arg IMAGE_ARCH=arm32v7 -t ${IMAGEEXT}:arm32v7-latest .
- docker push ${IMAGEEXT}:arm32v7-latest
only:
- master
deploy_docker_ext_arm64v8:
stage: deploy
before_script:
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD docker.io
script:
- docker build --build-arg IMAGE_ARCH=arm64v8 -t ${IMAGEEXT}:arm64v8-latest .
- docker push ${IMAGEEXT}:arm64v8-latest
only:
- master
deploy_docker_ext_i386:
stage: deploy
before_script:
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD docker.io
script:
- docker build --build-arg IMAGE_ARCH=i386 -t ${IMAGEEXT}:i386-latest .
- docker push ${IMAGEEXT}:i386-latest
only:
- master
manifest_ext:
stage: manifest
before_script:
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD docker.io
script:
- docker pull ${IMAGEEXT}:amd64-latest
- docker pull ${IMAGEEXT}:arm32v6-latest
- docker pull ${IMAGEEXT}:arm32v7-latest
- docker pull ${IMAGEEXT}:arm64v8-latest
- docker pull ${IMAGEEXT}:i386-latest
- docker manifest create ${IMAGEEXT}:latest ${IMAGEEXT}:amd64-latest ${IMAGEEXT}:arm32v6-latest ${IMAGEEXT}:arm32v7-latest ${IMAGEEXT}:arm64v8-latest ${IMAGEEXT}:i386-latest
- docker manifest annotate ${IMAGEEXT}:latest ${IMAGEEXT}:amd64-latest --os linux --arch amd64
- docker manifest annotate ${IMAGEEXT}:latest ${IMAGEEXT}:arm32v6-latest --os linux --arch arm --variant v6
- docker manifest annotate ${IMAGEEXT}:latest ${IMAGEEXT}:arm32v7-latest --os linux --arch arm --variant v7
- docker manifest annotate ${IMAGEEXT}:latest ${IMAGEEXT}:arm64v8-latest --os linux --arch arm64 --variant armv8
- docker manifest annotate ${IMAGEEXT}:latest ${IMAGEEXT}:i386-latest --os linux --arch 386
- docker manifest push ${IMAGEEXT}:latest
only:
- master