-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
58 lines (53 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
stages:
- build
- test
variables:
VERSION: 1.1.0
### Global Rules ###
workflow:
rules:
- if: $CI_COMMIT_BRANCH
### Build Container ###
BUILD::container:
image: docker:stable
stage: build
services:
- docker:stable-dind
before_script:
- mkdir -p $HOME/.docker/cli-plugins/
- wget -O $HOME/.docker/cli-plugins/docker-buildx https://github.com/docker/buildx/releases/download/v$BUILDX_VERSION/buildx-v$BUILDX_VERSION.linux-amd64
- chmod a+x $HOME/.docker/cli-plugins/docker-buildx
- docker run --privileged --rm tonistiigi/binfmt --uninstall qemu-*
- docker run --privileged --rm tonistiigi/binfmt --install $BUILDX_PLATFORM
- docker buildx create --use --driver docker-container --name binfmt --platform=$BUILDX_PLATFORM
- docker login -u $CI_REGISTRY_USER -p ${CI_REGISTRY_PASSWORD} $CI_REGISTRY
- docker login -u $DOCKERHUB_USER -p $DOCKERHUB_REGISTRY_TOKEN
script:
- >
docker buildx build \
--build-arg BUILD_DATE=$DATE \
--build-arg VCS_REF=$CI_COMMIT_SHA \
--build-arg VERSION=$VERSION \
--tag $CI_REGISTRY_IMAGE:latest \
--tag $CI_REGISTRY_IMAGE:$VERSION \
--tag $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:$CI_COMMIT_SHA \
--tag $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:latest \
--tag $DOCKER_REGISTRY_TAG:latest \
--tag $DOCKER_REGISTRY_TAG:$VERSION \
--platform $BUILDX_PLATFORM \
--push \
.
dependencies: []
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
### Includes ###
include:
- template: Jobs/Code-Intelligence.gitlab-ci.yml
- template: Jobs/Code-Quality.gitlab-ci.yml
- template: Security/Container-Scanning.gitlab-ci.yml
- template: Security/Dependency-Scanning.gitlab-ci.yml
- template: Security/License-Scanning.gitlab-ci.yml
- template: Security/SAST.gitlab-ci.yml
container_scanning:
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH