From fc3f5bddf3ed5bb2bec69b656db5121a46a4a701 Mon Sep 17 00:00:00 2001 From: Nandor Kracser Date: Fri, 23 Nov 2018 09:03:11 +0100 Subject: [PATCH] Add build_args support --- Dockerfile | 7 ++++++- plugin.sh | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 45002b7..72be060 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,7 @@ -FROM gcr.io/kaniko-project/executor:v0.6.0 AS kaniko +# TODO use the original image, but currently this is a blocker: +# https://github.com/GoogleContainerTools/kaniko/pull/459 +FROM banzaicloud/kaniko:latest AS kaniko +# FROM gcr.io/kaniko-project/executor:v0.6.0 AS kaniko FROM alpine:3.8 @@ -10,6 +13,8 @@ ENV SSL_CERT_DIR=/kaniko/ssl/certs ENV DOCKER_CONFIG /kaniko/.docker/ ENV DOCKER_CREDENTIAL_GCR_CONFIG /kaniko/.config/gcloud/docker_credential_gcr_config.json +RUN apk add --update --no-cache jq + # add the wrapper which acts as a drone plugin COPY plugin.sh /usr/bin/ ENTRYPOINT [ "/usr/bin/plugin.sh" ] diff --git a/plugin.sh b/plugin.sh index c252e58..9611d22 100755 --- a/plugin.sh +++ b/plugin.sh @@ -20,8 +20,10 @@ DOCKERFILE=${PLUGIN_DOCKERFILE:-Dockerfile} DESTINATION=${PLUGIN_REPO}:${PLUGIN_TAGS:-latest} CONTEXT=${PLUGIN_CONTEXT:-$PWD} LOG=${PLUGIN_LOG:-info} +BUILD_ARGS=`echo ${PLUGIN_BUILD_ARGS:-} | jq -r 'map("--build-arg " + .) | join(" ")'` /kaniko/executor -v ${LOG} \ --context ${CONTEXT} \ --dockerfile ${DOCKERFILE} \ - --destination ${DESTINATION} + --destination ${DESTINATION} \ + ${BUILD_ARGS}