Compare commits
8 commits
Author | SHA1 | Date | |
---|---|---|---|
8ba1608afe | |||
7589c04e3f | |||
e3c4b9878e | |||
b0857dcff7 | |||
dffa17475a | |||
4496efe737 | |||
43c892c45f | |||
|
8060274e8f |
4 changed files with 61 additions and 11 deletions
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"cSpell.words": ["elif", "kaniko"]
|
||||||
|
}
|
10
LICENSE
Normal file
10
LICENSE
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2023 s3lph
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
23
README.md
23
README.md
|
@ -1,10 +1,10 @@
|
||||||
# Kaniko Action
|
# Kaniko Action
|
||||||
|
|
||||||
Build OCI images using Kaniko, with the Dockerfile contents provided directly as an action input.
|
Build OCI images using Kaniko.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Example:
|
### Example: Basic Usage, all options.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
jobs:
|
jobs:
|
||||||
|
@ -21,3 +21,22 @@ jobs:
|
||||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Example: Multiple Tags, Default registry
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
jobs:
|
||||||
|
cowsay:
|
||||||
|
runs-on: docker
|
||||||
|
steps:
|
||||||
|
- uses: https://github.com/leandro-costa-oliveira/forgejo-kaniko-action@v2
|
||||||
|
with:
|
||||||
|
image: my-user/test-image:latest,my-user/test-image:${{ github.sha }}
|
||||||
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Credits
|
||||||
|
|
||||||
|
Original creator of the action v1:
|
||||||
|
https://git.kabelsalat.ch/s3lph/forgejo-kaniko-action
|
||||||
|
|
36
action.yml
36
action.yml
|
@ -1,17 +1,20 @@
|
||||||
---
|
---
|
||||||
|
name: Forgejo Kaniko
|
||||||
name: Kaniko
|
|
||||||
description: Build a container image using Kaniko
|
description: Build a container image using Kaniko
|
||||||
|
branding:
|
||||||
|
icon: anchor
|
||||||
|
color: blue
|
||||||
inputs:
|
inputs:
|
||||||
Dockerfile:
|
dockerfile:
|
||||||
description: The Dockerfile to pass to Kaniko
|
description: The Dockerfile to pass to Kaniko
|
||||||
required: true
|
required: false
|
||||||
image:
|
image:
|
||||||
description: Name and tag under which to upload the image
|
description: Name and tag under which to upload the image
|
||||||
required: true
|
required: true
|
||||||
registry:
|
registry:
|
||||||
description: Domain of the registry. Should be the same as the first path component of the tag.
|
description: Domain of the registry. Should be the same as the first path component of the tag.
|
||||||
required: true
|
required: false
|
||||||
|
default: https://index.docker.io/v1/
|
||||||
username:
|
username:
|
||||||
description: Username for the container registry
|
description: Username for the container registry
|
||||||
required: true
|
required: true
|
||||||
|
@ -27,7 +30,22 @@ runs:
|
||||||
- |
|
- |
|
||||||
mkdir -p /kaniko/.docker
|
mkdir -p /kaniko/.docker
|
||||||
echo '{"auths":{"${{ inputs.registry }}":{"auth":"'$(printf "%s:%s" "${{ inputs.username }}" "${{ inputs.password }}" | base64 | tr -d '\n')'"}}}' > /kaniko/.docker/config.json
|
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 }}
|
if [ -n "${{ inputs.dockerfile }}" ]; then
|
||||||
EOF
|
echo "Using Dockerfile from input"
|
||||||
/kaniko/executor --dockerfile Dockerfile --destination ${{ inputs.image }}
|
echo "${{ inputs.dockerfile }}" > Dockerfile
|
||||||
|
elif [ -f "./Dockerfile" ]; then
|
||||||
|
echo "Using existing ./Dockerfile from workspace"
|
||||||
|
else
|
||||||
|
echo "ERROR: No Dockerfile provided and no ./Dockerfile found in workspace"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
dest_flags=""
|
||||||
|
for dest in $(echo "${{ inputs.image }}" | tr ',' ' '); do
|
||||||
|
dest_flags="$dest_flags --destination=$dest"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Destinations: $dest_flags"
|
||||||
|
|
||||||
|
/kaniko/executor --dockerfile Dockerfile --context $GITHUB_WORKSPACE $dest_flags
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue