Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
ESCAPE2020
WP3
eossr
Commits
abdc41c5
Commit
abdc41c5
authored
Apr 21, 2022
by
vuillaut
Browse files
reeplace docker with kaniko for the container build in CI
parent
a5c5484f
Pipeline
#173185
passed with stage
in 12 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
28 deletions
+29
-28
.gitlab-ci.yml
.gitlab-ci.yml
+29
-28
No files found.
.gitlab-ci.yml
View file @
abdc41c5
...
...
@@ -66,39 +66,40 @@ test_codemeta_ingestion:
-
changes
:
-
codemeta.json
build_docker
:
stage
:
build_containers
image
:
docker:19.03.12
services
:
-
docker:19.03.12-dind
before_script
:
-
cat /etc/os-release
# "Alpine Linux v3.12"
-
apk add --no-cache git
-
export LAST_RELEASE=`git ls-remote --tags --refs --sort="v:refname" $CI_PROJECT_URL.git | tail -n1 | sed 's/.*\///'`
-
echo $LAST_RELEASE
image
:
name
:
gcr.io/kaniko-project/executor:debug
entrypoint
:
[
"
"
]
script
:
-
echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" "$CI_REGISTRY" --password-stdin
-
docker build -t $CI_REGISTRY_IMAGE:$LAST_RELEASE .
-
docker push $CI_REGISTRY_IMAGE:$LAST_RELEASE
-
docker tag $CI_REGISTRY_IMAGE:$LAST_RELEASE $CI_REGISTRY_IMAGE:latest
-
docker push $CI_REGISTRY_IMAGE:latest
only
:
-
tags
-
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
-
>-
/kaniko/executor
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--destination "${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}"
--destination "${CI_REGISTRY_IMAGE}:latest"
rules
:
-
if
:
$CI_COMMIT_TAG
# build_docker_main:
# stage: build_containers
# image: docker:19.03.12
# services:
# - docker:19.03.12-dind
# before_script:
# - cat /etc/os-release # "Alpine Linux v3.12"
# script:
# - echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" "$CI_REGISTRY" --password-stdin
# - docker build -t $CI_REGISTRY_IMAGE:dev .
# - docker push $CI_REGISTRY_IMAGE:dev
# only:
# - master
build_docker_main
:
stage
:
build_containers
image
:
name
:
gcr.io/kaniko-project/executor:debug
entrypoint
:
[
"
"
]
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
-
>-
/kaniko/executor
--context "${CI_PROJECT_DIR}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--destination "${CI_REGISTRY_IMAGE}:dev"
only
:
-
master
deploy_zenodo
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment