Skip to content
Snippets Groups Projects
Commit 67a13b6f authored by Jan Hartig's avatar Jan Hartig
Browse files

Merge branch 'kaniko' into 'main'

Use Kaniko for image builds

See merge request !20
parents 928d22e5 1fc45369
Branches
Tags 1.3
1 merge request!20Use Kaniko for image builds
Pipeline #22069 passed
docker-build:
image: docker:24-dind
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
services:
- name: docker:24-dind
alias: docker
command: ["--tls=false"]
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
# Default branch leaves tag empty (= latest tag)
# All other branches are tagged with the escaped branch name (commit ref slug)
build:
stage: build
image:
name: gcr.io/kaniko-project/executor:v1.9.0-debug
entrypoint: [""]
script:
- |
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
tag=""
tag="latest"
echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'"
else
tag=":$CI_COMMIT_REF_NAME"
tag="$CI_COMMIT_REF_NAME"
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
fi
- docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
- docker push "$CI_REGISTRY_IMAGE${tag}"
# Run this job in a branch where a Dockerfile exists
- /kaniko/executor
--context "${CI_PROJECT_DIR}"
--build-arg http_proxy=$http_proxy
--build-arg https_proxy=$https_proxy
--build-arg no_proxy=$no_proxy
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--destination "$CI_REGISTRY_IMAGE:${tag}"
rules:
- if: $CI_COMMIT_BRANCH
exists:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment