forked from psi-4ward/docker-powerdns
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
64 lines (55 loc) · 1.65 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
---
image: $CI_REGISTRY/fn/docker/ci-docker:latest
services:
- docker:dind
.build:
stage: build
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
before_script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(echo -n ${CI_REGISTRY_USER}:${CI_REGISTRY_PASSWORD} | base64)\"}}}" > /kaniko/.docker/config.json
variables:
DOCKER_DRIVER: overlay2
GOSS_FILES_STRATEGY: cp
TEST_IMAGE: $CI_REGISTRY_IMAGE/test:$CI_COMMIT_SHA
stages:
- lint
- build
- test
- release
lint_docker:
stage: lint
image: ghcr.io/hadolint/hadolint:latest-alpine
script:
- hadolint --version
- hadolint Dockerfile
build_image:
extends: .build
script:
- >
/kaniko/executor --context $CI_PROJECT_DIR
--dockerfile $CI_PROJECT_DIR/Dockerfile
--destination $TEST_IMAGE
test_image:
stage: test
before_script:
- echo "$CI_REGISTRY_PASSWORD" | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
- docker pull $TEST_IMAGE
script:
- dgoss run $TEST_IMAGE pdns_server
release_tags:
stage: release
before_script:
- echo "$CI_REGISTRY_PASSWORD" | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
script:
- docker pull $TEST_IMAGE
- docker tag $TEST_IMAGE $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
- docker tag $TEST_IMAGE $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA
- docker tag $TEST_IMAGE $CI_REGISTRY_IMAGE:latest
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA
- docker push $CI_REGISTRY_IMAGE:latest
rules:
- if: $CI_COMMIT_TAG