-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
53 lines (50 loc) · 1.38 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
.builder:
stage: build
image:
name: moby/buildkit:rootless
entrypoint: [sh, -c]
variables:
BUILDKITD_FLAGS: --oci-worker-no-process-sandbox
before_script:
- |
mkdir -p ~/.docker && cat > ~/.docker/config.json <<EOF
{
"auths": {
"$CI_REGISTRY": {
"auth": "$(echo -n "$CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD" | base64)"
}
}
}
EOF
- |
dockerbuild() {
buildctl-daemonless.sh build \
--frontend=dockerfile.v0 \
--local context=. \
--local dockerfile=. \
--opt build-arg:VERSION=$1 \
--opt build-arg:COMMIT=$CI_COMMIT_SHA \
--output type=image,name=$CI_REGISTRY_IMAGE:$1,push=true
buildctl-daemonless.sh build \
--frontend=dockerfile.v0 \
--local context=. \
--local dockerfile=. \
--opt build-arg:VERSION=$1 \
--opt build-arg:COMMIT=$CI_COMMIT_SHA \
--output type=image,name=$CI_REGISTRY_IMAGE:latest,push=true
}
deploy:
extends: .builder
rules:
- if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/
script:
- dockerbuild $CI_COMMIT_TAG
automirror:
stage: deploy
resource_group: production
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
image:
name: $CI_REGISTRY_IMAGE:latest
entrypoint: ['']
script: [/app/automirror --config "$CONFIG_FILE"]