Skip to content

Instantly share code, notes, and snippets.

@peterjaap
Last active January 12, 2022 16:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterjaap/4e5816a78a1a266c6cf070930fbb0272 to your computer and use it in GitHub Desktop.
Save peterjaap/4e5816a78a1a266c6cf070930fbb0272 to your computer and use it in GitHub Desktop.
Generic Gitlab CI file to build and push a Docker container to the private registry using kaniko (no Docker in Docker privileged mode needed)
image: docker:latest
stages:
- build
build:
stage: build
only:
- master
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment