Commit 53418b68 authored by Felix Haase's avatar Felix Haase
Browse files

Use docker to build, since kaniko fails for unknown reason

parent 0afb8a81
Pipeline #1033 passed with stage
in 2 minutes and 40 seconds
......@@ -5,19 +5,43 @@ stages:
- test
- deploy
variables:
# When using dind service, we need to instruct docker, to talk with
# the daemon started inside of the service. The daemon is available
# with a network connection instead of the default
# /var/run/docker.sock socket. docker:19.03.1 does this automatically
# by setting the DOCKER_HOST in
# https://github.com/docker-library/docker/blob/d45051476babc297257df490d22cbd806f1b11e4/19.03.1/docker-entrypoint.sh#L23-L29
#
# The 'docker' hostname is the alias of the service container as described at
# https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#accessing-the-services.
#
# Note that if you're using GitLab Runner 12.7 or earlier with the Kubernetes executor and Kubernetes 1.6 or earlier,
# the variable must be set to tcp://localhost:2376 because of how the
# Kubernetes executor connects services to the job container
# DOCKER_HOST: tcp://localhost:2376
#
# Specify to Docker where to create the certificates, Docker will
# create them automatically on boot, and will create
# `/certs/client` that will be shared between the service and job
# container, thanks to volume mount from config.toml
DOCKER_TLS_CERTDIR: "/certs"
DOCKER_DRIVER: overlay
.kaniko-build:
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: ['']
.docker-build:
image: docker:19.03
tags:
- build
- docker
services:
- docker:19.03-dind
before_script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- docker info
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- /kaniko/executor --context $CI_PROJECT_DIR/$IMAGE_PATH --dockerfile $CI_PROJECT_DIR/$IMAGE_PATH/Dockerfile --destination $IMAGE_NAME/$IMAGE_PATH:$IMAGE_TAG
- docker build --pull -t "$IMAGE_NAME/$IMAGE_PATH:$IMAGE_TAG" $IMAGE_PATH
- docker push "$IMAGE_NAME/$IMAGE_PATH:$IMAGE_TAG"
parallel:
matrix:
- IMAGE_PATH: [build, base]
......@@ -27,7 +51,7 @@ docker-build-master:
# Official docker image.
stage: build
extends:
.kaniko-build
.docker-build
variables:
IMAGE_NAME: $CI_REGISTRY_IMAGE
IMAGE_TAG: latest
......@@ -38,7 +62,7 @@ docker-build-branches:
# Official docker image.
stage: build
extends:
.kaniko-build
.docker-build
variables:
IMAGE_NAME: $CI_REGISTRY_IMAGE
IMAGE_TAG: $CI_COMMIT_REF_SLUG
......@@ -50,7 +74,7 @@ docker-build-branches:
docker-build-tags:
stage: build
extends:
.kaniko-build
.docker-build
variables:
IMAGE_NAME: $CI_REGISTRY_IMAGE
IMAGE_TAG: $CI_COMMIT_REF_NAME
......
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