50
loading...
This website collects cookies to deliver better user experience
Dockerfile
:FROM node:16.5.0
USER node
root
user. Some npm features are turned off for root, so it's better to run our builds on a different user..gitlab-ci.yml
goes as follow:stages:
- build
docker-image:
stage: build
docker-image
job & setting it to build
stageimage:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
entrypoint: [""]
overrides the entry point of the image. I found it while setting up this thing myself, and indeed if I remove this line the build failsscript:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
mkdir -p /kaniko/.docker
- creates a folder from where kaniko reads access fileecho ...
- puts the GitLab registry access info to file that will be read by kaniko. Note! Those values are provided by GitLab, you don't have to set up credentials yourself.
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE
--destination $CI_REGISTRY_IMAGE
with --destination $CI_REGISTRY_IMAGE/image-name
- in this way you can fit multiple images next to each other..gitlab-ci.yml
:stages:
- build
docker-image:
stage: build
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- mkdir -p /kaniko/.docker
- 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
/kaniko/executor
calls with other files.