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
8 months ago
by
Milan Čermák
Browse files
Options
Downloads
Patches
Plain Diff
Upgrade to Kaniko builder
parent
a70dbec5
No related branches found
No related tags found
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
:
stages
:
image
:
docker:latest
-
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
stage
:
build
services
:
before_script
:
[
]
# Prevent global before_script from running
-
docker:dind
image
:
variables
:
name
:
gcr.io/kaniko-project/executor:v1.23.2-debug
IMAGE_TAG
:
$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
entrypoint
:
[
"
"
]
before_script
:
-
docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script
:
script
:
-
docker build --pull -t "$IMAGE_TAG" .
-
/kaniko/executor
-
docker push "$IMAGE_TAG"
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--destination "${IMAGE_TEST_BUILD}"
--no-push
except
:
except
:
-
master
-
tags
build-latest
:
# Build and publish Docker image when a new tag is defined
image
:
docker:latest
docker_build_push
:
stage
:
build
stage
:
build_push
services
:
image
:
-
docker:dind
name
:
gcr.io/kaniko-project/executor:v1.23.2-debug
variables
:
entrypoint
:
[
"
"
]
IMAGE_TAG
:
$CI_REGISTRY_IMAGE:latest
before_script
:
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
:
script
:
-
docker build --pull -t "$IMAGE_TAG" .
-
/kaniko/executor
-
docker push "$IMAGE_TAG"
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--destination "${IMAGE_TAG}"
only
:
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