2019-01-07 23:31:10 +01:00
|
|
|
#!/busybox/sh
|
2018-11-21 15:45:09 +01:00
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
export PATH=$PATH:/kaniko/
|
|
|
|
|
2019-01-07 23:31:10 +01:00
|
|
|
DOCKER_AUTH=`echo -n "${PLUGIN_USERNAME}:${PLUGIN_PASSWORD}" | base64`
|
2018-11-21 15:45:09 +01:00
|
|
|
|
2019-01-07 23:31:10 +01:00
|
|
|
REGISTRY=${PLUGIN_REGISTRY:-https://index.docker.io/v1/}
|
2019-01-07 03:42:42 +01:00
|
|
|
|
2019-01-07 23:31:10 +01:00
|
|
|
cat > /kaniko/.docker/config.json <<DOCKERJSON
|
2018-11-21 15:45:09 +01:00
|
|
|
{
|
|
|
|
"auths": {
|
2019-01-07 03:42:42 +01:00
|
|
|
"${REGISTRY}": {
|
2018-11-21 15:45:09 +01:00
|
|
|
"auth": "${DOCKER_AUTH}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DOCKERJSON
|
|
|
|
|
|
|
|
DOCKERFILE=${PLUGIN_DOCKERFILE:-Dockerfile}
|
|
|
|
DESTINATION=${PLUGIN_REPO}:${PLUGIN_TAGS:-latest}
|
|
|
|
CONTEXT=${PLUGIN_CONTEXT:-$PWD}
|
|
|
|
LOG=${PLUGIN_LOG:-info}
|
2019-01-07 23:31:10 +01:00
|
|
|
case "${PLUGIN_CACHE:-}" in
|
|
|
|
true) CACHE="true" ;;
|
|
|
|
*) CACHE="false" ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
if [[ -n "${PLUGIN_BUILD_ARGS:-}" ]]; then
|
|
|
|
BUILD_ARGS=$(echo "${PLUGIN_BUILD_ARGS}" | tr ',' '\n' | while read build_arg; do echo "--build-arg=${build_arg}"; done)
|
|
|
|
fi
|
2018-11-21 15:45:09 +01:00
|
|
|
|
|
|
|
/kaniko/executor -v ${LOG} \
|
2019-01-07 23:31:10 +01:00
|
|
|
--context=${CONTEXT} \
|
|
|
|
--dockerfile=${DOCKERFILE} \
|
|
|
|
--destination=${DESTINATION} \
|
|
|
|
--cache=${CACHE} \
|
|
|
|
${BUILD_ARGS:-}
|