forked from janw/pi-hole-influx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
62 lines (52 loc) · 1.78 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
image: docker:stable
services:
- docker:dind
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
stages:
- build
- tag
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
build:
stage: build
script:
- docker pull $CI_REGISTRY_IMAGE:latest || true
- docker build
--tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
tag latest:
stage: tag
script:
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA $CI_REGISTRY_IMAGE:latest
- docker push $CI_REGISTRY_IMAGE:latest
only:
- master
## Aditional build jobs for special-flavor Dockerfiles
## ----
.build special:
stage: build
variables:
BUILD_DOCKERFILE: Dockerfile
script:
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- docker pull $CI_REGISTRY_IMAGE:$IMAGE_FLAVOR || true
- docker build
--build-arg BUILD_FROM=${BUILD_FROM}
--tag $CI_REGISTRY_IMAGE:${IMAGE_FLAVOR}-$CI_COMMIT_SHORT_SHA
--file ${BUILD_DOCKERFILE} .
- docker run --rm $CI_REGISTRY_IMAGE:${IMAGE_FLAVOR}-$CI_COMMIT_SHORT_SHA uname -m
- docker push $CI_REGISTRY_IMAGE:${IMAGE_FLAVOR}-$CI_COMMIT_SHORT_SHA
.tag special:
stage: tag
script:
- docker pull $CI_REGISTRY_IMAGE:${IMAGE_FLAVOR}-$CI_COMMIT_SHORT_SHA
- docker tag $CI_REGISTRY_IMAGE:${IMAGE_FLAVOR}-$CI_COMMIT_SHORT_SHA $CI_REGISTRY_IMAGE:${IMAGE_FLAVOR}
- docker push $CI_REGISTRY_IMAGE:${IMAGE_FLAVOR}
only:
- master
build armv7: {extends: .build special, variables: {IMAGE_FLAVOR: armv7, BUILD_FROM: "arm32v7/python:3.6-alpine"}}
tag armv7: {extends: .tag special, variables: {IMAGE_FLAVOR: armv7}}