Skip to content
Snippets Groups Projects
Verified Commit faff9368 authored by Mark's avatar Mark
Browse files

Add build arg to kaniko image

parent c7758c32
No related merge requests found
...@@ -8,6 +8,13 @@ ...@@ -8,6 +8,13 @@
# #
# - KANIKO_CONTEXT: The subdir which holds the Dockerfile, leave unset if # - KANIKO_CONTEXT: The subdir which holds the Dockerfile, leave unset if
# the Dockerfile is located at root level of the project. # the Dockerfile is located at root level of the project.
#
# - KANIKO_EXTEND_BASEIMAGE: Name of an image that is build in the same
# pipeline and is being used by your dockerfile as a baseimage.
# You need to specify the argument `baseimage` in your dockerfile and use
# this argument in the `FROM` instruction.
# see [how to use build arguments](https://docs.docker.com/engine/reference/builder/#arg)
# for more information.
.kaniko_build: .kaniko_build:
stage: build stage: build
image: image:
...@@ -18,4 +25,5 @@ ...@@ -18,4 +25,5 @@
script: script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- if [ -n "${KANIKO_BUILD_IMAGENAME}" ]; then export IMAGENAME="/${KANIKO_BUILD_IMAGENAME}"; fi - if [ -n "${KANIKO_BUILD_IMAGENAME}" ]; then export IMAGENAME="/${KANIKO_BUILD_IMAGENAME}"; fi
- /kaniko/executor --context ${CI_PROJECT_DIR}/${KANIKO_CONTEXT:-.} --dockerfile ${CI_PROJECT_DIR}/${KANIKO_CONTEXT:-.}/Dockerfile --destination ${CI_REGISTRY_IMAGE}${IMAGENAME}:${CI_COMMIT_REF_NAME} - if [ -n "${KANIKO_EXTEND_BASEIMAGE}" ]; then export BASEIMAGE="--build-arg baseimage=${CI_REGISTRY_IMAGE}/${KANIKO_EXTEND_BASEIMAGE}:${CI_COMMIT_REF_NAME}"; fi
- /kaniko/executor --context ${CI_PROJECT_DIR}/${KANIKO_CONTEXT:-.} --dockerfile ${CI_PROJECT_DIR}/${KANIKO_CONTEXT:-.}/Dockerfile --destination ${CI_REGISTRY_IMAGE}${IMAGENAME}:${CI_COMMIT_REF_NAME} ${BASEIMAGE}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment