forked from devture/matrix-corporal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.woodpecker.yml
115 lines (97 loc) · 4.5 KB
/
.woodpecker.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
variables:
- &docker_with_buildx_container_image 'docker.io/jdrouet/docker-with-buildx:20.10.21-0.9.1'
- &docker_in_docker_container_image 'docker.io/docker:20.10.21-dind'
pipeline:
init:
image: *docker_with_buildx_container_image
commands:
- echo "Waiting for dind to start before running the other stages..."
- sleep 5
build-arm32v7:
group: build
image: *docker_with_buildx_container_image
environment:
- DOCKER_HOST=tcp://docker:2375
- DOCKER_TLS_CERTDIR=""
- DOCKER_DRIVER=overlay2
commands:
- docker buildx create --use
- docker buildx build --platform linux/arm/v7 --load -t devture/matrix-corporal:current-arm32v7 -f etc/docker/Dockerfile .
build-arm64v8:
group: build
image: *docker_with_buildx_container_image
environment:
- DOCKER_HOST=tcp://docker:2375
- DOCKER_TLS_CERTDIR=""
- DOCKER_DRIVER=overlay2
commands:
- docker buildx create --use
- docker buildx build --platform linux/arm64/v8 --load -t devture/matrix-corporal:current-arm64v8 -f etc/docker/Dockerfile .
build-amd64:
group: build
image: *docker_with_buildx_container_image
environment:
- DOCKER_HOST=tcp://docker:2375
- DOCKER_TLS_CERTDIR=""
- DOCKER_DRIVER=overlay2
commands:
- docker buildx create --use
- docker buildx build --platform linux/amd64 --load -t devture/matrix-corporal:current-amd64 -f etc/docker/Dockerfile .
push-for-branch:
when:
branch:
include: [master]
image: *docker_with_buildx_container_image
environment:
- DOCKER_HOST=tcp://docker:2375
- DOCKER_TLS_CERTDIR=""
- DOCKER_DRIVER=overlay2
secrets:
- CONTAINER_REGISTRY
- CONTAINER_REGISTRY_USER
- CONTAINER_REGISTRY_PASSWORD
commands:
- |
container_image_tag_to_publish=$CI_BRANCH
if [ "$CI_BRANCH" == "master" ]; then
container_image_tag_to_publish=latest
fi
- "echo 'Publishing: '$container_image_tag_to_publish"
- docker login $CONTAINER_REGISTRY -u $CONTAINER_REGISTRY_USER -p $CONTAINER_REGISTRY_PASSWORD
- |
for platform_identifier in amd64 arm64v8 arm32v7; do
docker tag devture/matrix-corporal:current-$platform_identifier $CONTAINER_REGISTRY/devture/matrix-corporal:$container_image_tag_to_publish-$platform_identifier
docker push $CONTAINER_REGISTRY/devture/matrix-corporal:$container_image_tag_to_publish-$platform_identifier
done
- docker manifest create $CONTAINER_REGISTRY/devture/matrix-corporal:$container_image_tag_to_publish $CONTAINER_REGISTRY/devture/matrix-corporal:$container_image_tag_to_publish-amd64 $CONTAINER_REGISTRY/devture/matrix-corporal:$container_image_tag_to_publish-arm64v8 $CONTAINER_REGISTRY/devture/matrix-corporal:$container_image_tag_to_publish-arm32v7
- docker manifest push $CONTAINER_REGISTRY/devture/matrix-corporal:$container_image_tag_to_publish
push-for-tag:
when:
branch: 'refs/tags/*'
image: *docker_with_buildx_container_image
environment:
- DOCKER_HOST=tcp://docker:2375
- DOCKER_TLS_CERTDIR=""
- DOCKER_DRIVER=overlay2
secrets:
- CONTAINER_REGISTRY
- CONTAINER_REGISTRY_USER
- CONTAINER_REGISTRY_PASSWORD
commands:
- env
- docker images
- container_image_tag_to_publish=$CI_COMMIT_TAG
- "echo 'Publishing: '$container_image_tag_to_publish"
- docker login $CONTAINER_REGISTRY -u $CONTAINER_REGISTRY_USER -p $CONTAINER_REGISTRY_PASSWORD
- |
for platform_identifier in amd64 arm64v8 arm32v7; do
docker tag devture/matrix-corporal:current-$platform_identifier $CONTAINER_REGISTRY/devture/matrix-corporal:$container_image_tag_to_publish-$platform_identifier
docker push $CONTAINER_REGISTRY/devture/matrix-corporal:$container_image_tag_to_publish-$platform_identifier
done
- docker manifest create $CONTAINER_REGISTRY/devture/matrix-corporal:$container_image_tag_to_publish $CONTAINER_REGISTRY/devture/matrix-corporal:$container_image_tag_to_publish-amd64 $CONTAINER_REGISTRY/devture/matrix-corporal:$container_image_tag_to_publish-arm64v8 $CONTAINER_REGISTRY/devture/matrix-corporal:$container_image_tag_to_publish-arm32v7
- docker manifest push $CONTAINER_REGISTRY/devture/matrix-corporal:$container_image_tag_to_publish
services:
docker:
image: *docker_in_docker_container_image
command: [ "dockerd", "--storage-driver=vfs", "--tls=false", "-H tcp://0.0.0.0:2375" ]
privileged: true