This repository has been archived by the owner on Nov 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
.gitlab-ci.yml
61 lines (58 loc) · 1.9 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
---
# Lint all Dockerfiles in this repo
docker-lint:
image: projectatomic/dockerfile-lint
stage: .pre
script:
- dockerfile_lint -f Dockerfile
- dockerfile_lint -f Dockerfile-geoip
# Docker buildx for multiplatform
buildx:
image: docker:stable-git
stage: .pre
variables:
GIT_STRATEGY: none
artifacts:
paths:
- buildx
expire_in: 6 hours
services:
- docker:stable-dind
script:
- export DOCKER_BUILDKIT=1
- git clone git://github.com/docker/buildx ./docker-buildx
- docker build --platform=local -o . ./docker-buildx
# I will unify these build steps once more when this GitLab CI issue is fixed:
# https://gitlab.com/gitlab-com/support-forum/issues/5036
build-amd64:
image: docker:stable
stage: build
services:
- name: docker:stable-dind
command: ["--experimental"]
retry: 2
before_script:
- mkdir -p ~/.docker/cli-plugins
- mv buildx ~/.docker/cli-plugins/docker-buildx
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker buildx create --use --name build-amd64
- docker buildx build --load --platform linux/amd64 -t "$CI_REGISTRY_IMAGE" -t "$CI_REGISTRY_IMAGE:x86_64" -f ./Dockerfile .
- docker push "$CI_REGISTRY_IMAGE"
build-aarch64:
image: docker:stable
stage: build
services:
- name: docker:stable-dind
command: ["--experimental"]
retry: 2
before_script:
- mkdir -p ~/.docker/cli-plugins
- mv buildx ~/.docker/cli-plugins/docker-buildx
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker buildx create --use --name build-aarch64
- docker buildx build --load --platform linux/arm64 -t "$CI_REGISTRY_IMAGE:aarch64" -f ./Dockerfile .
- docker push "$CI_REGISTRY_IMAGE:aarch64"