mirror of
https://github.com/aevea/action-kaniko.git
synced 2025-01-30 22:09:37 +01:00
feat: Allow custom context path
This commit is contained in:
parent
51211d4483
commit
94f437184e
3 changed files with 9 additions and 2 deletions
|
@ -53,6 +53,7 @@ the most used values. So, technically there is a single required argument
|
||||||
| extra_args | Additional arguments to be passed to the kaniko executor | false | |
|
| extra_args | Additional arguments to be passed to the kaniko executor | false | |
|
||||||
| strip_tag_prefix | Prefix to be stripped from the tag | false | |
|
| strip_tag_prefix | Prefix to be stripped from the tag | false | |
|
||||||
| skip_unchanged_digest | Avoids pushing the image if the build generated the same digest | false | |
|
| skip_unchanged_digest | Avoids pushing the image if the build generated the same digest | false | |
|
||||||
|
| path | Path to the build context. Defaults to `.` | false | . |
|
||||||
|
|
||||||
**Here is where it gets specific, as the optional arguments become required depending on the registry targeted**
|
**Here is where it gets specific, as the optional arguments become required depending on the registry targeted**
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,10 @@ branding:
|
||||||
icon: anchor
|
icon: anchor
|
||||||
color: orange
|
color: orange
|
||||||
inputs:
|
inputs:
|
||||||
|
path:
|
||||||
|
description: Path to the build context
|
||||||
|
required: false
|
||||||
|
default: "."
|
||||||
registry:
|
registry:
|
||||||
description: "Docker registry where the image will be pushed"
|
description: "Docker registry where the image will be pushed"
|
||||||
required: false
|
required: false
|
||||||
|
|
|
@ -11,6 +11,7 @@ export USERNAME=${INPUT_USERNAME:-$GITHUB_ACTOR}
|
||||||
export PASSWORD=${INPUT_PASSWORD:-$GITHUB_TOKEN}
|
export PASSWORD=${INPUT_PASSWORD:-$GITHUB_TOKEN}
|
||||||
export REPOSITORY=$IMAGE
|
export REPOSITORY=$IMAGE
|
||||||
export IMAGE=$IMAGE:$TAG
|
export IMAGE=$IMAGE:$TAG
|
||||||
|
export CONTEXT_PATH=${INPUT_PATH}
|
||||||
|
|
||||||
function ensure() {
|
function ensure() {
|
||||||
if [ -z "${1}" ]; then
|
if [ -z "${1}" ]; then
|
||||||
|
@ -24,6 +25,7 @@ ensure "${USERNAME}" "username"
|
||||||
ensure "${PASSWORD}" "password"
|
ensure "${PASSWORD}" "password"
|
||||||
ensure "${IMAGE}" "image"
|
ensure "${IMAGE}" "image"
|
||||||
ensure "${TAG}" "tag"
|
ensure "${TAG}" "tag"
|
||||||
|
ensure "${CONTEXT_PATH}" "path"
|
||||||
|
|
||||||
if [ "$REGISTRY" == "docker.pkg.github.com" ]; then
|
if [ "$REGISTRY" == "docker.pkg.github.com" ]; then
|
||||||
IMAGE_NAMESPACE="$(echo $GITHUB_REPOSITORY | tr '[:upper:]' '[:lower:]')"
|
IMAGE_NAMESPACE="$(echo $GITHUB_REPOSITORY | tr '[:upper:]' '[:lower:]')"
|
||||||
|
@ -45,8 +47,8 @@ export CACHE=${INPUT_CACHE:+"--cache=true"}
|
||||||
export CACHE=$CACHE${INPUT_CACHE_TTL:+" --cache-ttl=$INPUT_CACHE_TTL"}
|
export CACHE=$CACHE${INPUT_CACHE_TTL:+" --cache-ttl=$INPUT_CACHE_TTL"}
|
||||||
export CACHE=$CACHE${INPUT_CACHE_REGISTRY:+" --cache-repo=$INPUT_CACHE_REGISTRY"}
|
export CACHE=$CACHE${INPUT_CACHE_REGISTRY:+" --cache-repo=$INPUT_CACHE_REGISTRY"}
|
||||||
export CACHE=$CACHE${INPUT_CACHE_DIRECTORY:+" --cache-dir=$INPUT_CACHE_DIRECTORY"}
|
export CACHE=$CACHE${INPUT_CACHE_DIRECTORY:+" --cache-dir=$INPUT_CACHE_DIRECTORY"}
|
||||||
export CONTEXT="--context $GITHUB_WORKSPACE"
|
export CONTEXT="--context $GITHUB_WORKSPACE/$CONTEXT_PATH"
|
||||||
export DOCKERFILE="--dockerfile ${INPUT_BUILD_FILE:-Dockerfile}"
|
export DOCKERFILE="--dockerfile $CONTEXT_PATH/${INPUT_BUILD_FILE:-Dockerfile}"
|
||||||
|
|
||||||
if [ ! -z $INPUT_SKIP_UNCHANGED_DIGEST ]; then
|
if [ ! -z $INPUT_SKIP_UNCHANGED_DIGEST ]; then
|
||||||
export DESTINATION="--no-push --digest-file digest"
|
export DESTINATION="--no-push --digest-file digest"
|
||||||
|
|
Loading…
Reference in a new issue