Skip to content
Snippets Groups Projects
Commit ef3334d8 authored by Kabir Kwatra's avatar Kabir Kwatra :comet:
Browse files

fix(ci): Changed GitLab CI Build Tool to Kaniko for Rootless Runners

parent 305e0b6d
Branches
No related tags found
No related merge requests found
# Author: Kabir Kwatra <kabir@kwatra.me>
image: docker:19
services: ["docker:19-dind"]
variables:
DOCKER_TLS_CERTDIR: "/certs"
stages: [build]
before_script:
- docker info
- echo -n $CI_JOB_TOKEN | docker login -u gitlab-ci-token --password-stdin $CI_REGISTRY
build:
stage: build
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- docker pull $CI_REGISTRY_IMAGE:latest || true
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- >
for containerfile_path in $(ls .github/containerfiles/*.Containerfile); do
containerfile_name=${containerfile_path##*/}
container_tag=${containerfile_name%%.*}
container_fulltag="$CI_REGISTRY_IMAGE:$container_tag"
echo "Building $containerfile_name with tag $container_fulltag"
docker build \
/kaniko/executor \
--context $CI_PROJECT_DIR \
--dockerfile $containerfile_path \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg VCS_REF=`git rev-parse --short HEAD` \
--build-arg OCI_SRC_URL=$CI_PROJECT_URL \
--cache-from $container_fulltag \
-f $containerfile_path \
-t $container_fulltag \
.
docker push $container_fulltag
--destination $container_fulltag
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment