Last active
January 12, 2022 16:37
-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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