Newer
Older
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
stages:
- build
- push
variables:
DOCKERIO_MIRROR: hub.wuhoo.xyz
build:
stage: build
image:
name: gcr.io/kaniko-project/executor:v1.9.0-debug
entrypoint: [""]
before_script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json
script:
- >-
/kaniko/executor
--registry-mirror "${DOCKERIO_MIRROR}"
--build-arg "CI_PROJECT_PATH"
--build-arg "CI_PROJECT_PATH"
--build-arg "CI_PROJECT_URL"
--build-arg "CI_COMMIT_SHORT_SHA"
--build-arg "CI_COMMIT_SHA"
--build-arg "CI_PIPELINE_ID"
--build-arg "CI_PIPELINE_URL"
--cache=true
--cache-repo "${CI_REGISTRY_IMAGE}/build-cache"
--cache-ttl 720h0m0s
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--destination=image
--no-push
--tarPath image.tar
artifacts:
untracked: false
expire_in: 7 days
paths:
- image.tar
when: on_success
push:
stage: push
image:
name: gcr.io/go-containerregistry/crane/debug:v0.11.0
entrypoint: [""]
script:
- crane auth login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
- crane push image.tar ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}
- crane push image.tar ${CI_REGISTRY_IMAGE}:latest
needs:
- build
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH