This repository has been archived on 2024-07-26. You can view files and clone it, but cannot push or open issues or pull requests.
drone-kaniko/plugin.sh
2018-11-23 09:03:11 +01:00

30 lines
682 B
Bash
Executable File

#!/bin/sh
set -euo pipefail
export PATH=$PATH:/kaniko/
DOCKER_AUTH=`echo -n "${DOCKER_USERNAME}:${DOCKER_PASSWORD}" | base64`
cat > /kaniko/.docker/config.json <<DOCKERJSON
{
"auths": {
"https://index.docker.io/v1/": {
"auth": "${DOCKER_AUTH}"
}
}
}
DOCKERJSON
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} \
${BUILD_ARGS}