feat: read Dockerfile from local file system
This commit is contained in:
parent
43c892c45f
commit
20209e6c17
1 changed files with 15 additions and 6 deletions
21
action.yml
21
action.yml
|
@ -2,9 +2,9 @@
|
|||
name: Kaniko
|
||||
description: Build a container image using Kaniko
|
||||
inputs:
|
||||
Dockerfile:
|
||||
dockerfile:
|
||||
description: The Dockerfile to pass to Kaniko
|
||||
required: true
|
||||
required: false
|
||||
image:
|
||||
description: Name and tag under which to upload the image
|
||||
required: true
|
||||
|
@ -27,7 +27,16 @@ runs:
|
|||
- |
|
||||
mkdir -p /kaniko/.docker
|
||||
echo '{"auths":{"${{ inputs.registry }}":{"auth":"'$(printf "%s:%s" "${{ inputs.username }}" "${{ inputs.password }}" | base64 | tr -d '\n')'"}}}' > /kaniko/.docker/config.json
|
||||
cat > Dockerfile <<EOF
|
||||
${{ inputs.Dockerfile }}
|
||||
EOF
|
||||
/kaniko/executor --dockerfile Dockerfile --destination ${{ inputs.image }}
|
||||
|
||||
if [ -n "${{ inputs.dockerfile }}" ]; then
|
||||
echo "Using Dockerfile from input"
|
||||
echo "${{ inputs.dockerfile }}" > Dockerfile
|
||||
elif [ -f "./Dockerfile" ]; then
|
||||
echo "Using existing ./Dockerfile from workspace"
|
||||
cp ./Dockerfile Dockerfile
|
||||
else
|
||||
echo "ERROR: No Dockerfile provided and no ./Dockerfile found in workspace"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
/kaniko/executor --dockerfile Dockerfile --destination "${{ inputs.image }}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue