Commit abdc41c5 authored by vuillaut's avatar vuillaut
Browse files

reeplace docker with kaniko for the container build in CI

parent a5c5484f
Pipeline #173185 passed with stage
in 12 seconds
......@@ -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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment