Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
Web interface
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Container registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GRANEF
Analysis
Web interface
Commits
d20f50a6
Commit
d20f50a6
authored
10 months ago
by
Milan Čermák
Browse files
Options
Downloads
Patches
Plain Diff
Upgrade to Kaniko builder
parent
a70dbec5
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+35
-23
35 additions, 23 deletions
.gitlab-ci.yml
with
35 additions
and
23 deletions
.gitlab-ci.yml
+
35
−
23
View file @
d20f50a6
# CI for automated build and publish of project containers
# CI for automated build and publish of project
Docker
containers
build-branches
:
image
:
docker:latest
stages
:
-
build
-
build_push
variables
:
IMAGE_TAG
:
$CI_REGISTRY_IMAGE:${CI_COMMIT_TAG}
IMAGE_TEST_BUILD
:
$CI_REGISTRY_IMAGE:test-build
# Check only for successful Docker image build
docker_build
:
stage
:
build
services
:
-
docker:dind
variables
:
IMAGE_TAG
:
$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
before_script
:
-
docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
before_script
:
[
]
# Prevent global before_script from running
image
:
name
:
gcr.io/kaniko-project/executor:v1.23.2-debug
entrypoint
:
[
"
"
]
script
:
-
docker build --pull -t "$IMAGE_TAG" .
-
docker push "$IMAGE_TAG"
-
/kaniko/executor
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--destination "${IMAGE_TEST_BUILD}"
--no-push
except
:
-
master
-
tags
build-latest
:
image
:
docker:latest
stage
:
build
services
:
-
docker:dind
variables
:
IMAGE_TAG
:
$CI_REGISTRY_IMAGE:latest
# Build and publish Docker image when a new tag is defined
docker_build_push
:
stage
:
build_push
image
:
name
:
gcr.io/kaniko-project/executor:v1.23.2-debug
entrypoint
:
[
"
"
]
before_script
:
-
docker login -u "$CI_REGISTRY_USER" -p
"$CI_REGISTRY_PASSWORD
" $CI_REGISTRY
-
echo "{\"auths\":{\"${CI_REGISTRY}\":{\"username\":\"${CI_REGISTRY_USER}\",\"password\":\
"$
{
CI_REGISTRY_PASSWORD
}\"}}}" > /kaniko/.docker/config.json
script
:
-
docker build --pull -t "$IMAGE_TAG" .
-
docker push "$IMAGE_TAG"
-
/kaniko/executor
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--destination "${IMAGE_TAG}"
only
:
-
master
-
tags
except
:
-
branches
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment