Compare commits
No commits in common. "61b0a93920f2f841dae5baaaf8d4720c59647608" and "79cf6ed704dc5df61ba58c3ccd8ff3bfa87a2b94" have entirely different histories.
61b0a93920
...
79cf6ed704
@ -1,3 +1,3 @@
|
||||
FROM gcr.io/kaniko-project/executor:v1.22.0-debug
|
||||
FROM gcr.io/kaniko-project/executor:debug
|
||||
COPY build.sh /usr/local/bin/
|
||||
ENTRYPOINT ["build.sh"]
|
||||
|
24
action.yaml
24
action.yaml
@ -1,17 +1,37 @@
|
||||
name: kaniko
|
||||
inputs:
|
||||
dockerfile:
|
||||
description: Dockerfile path
|
||||
required: true
|
||||
default: ./Dockerfile
|
||||
registry:
|
||||
description: Registry URL
|
||||
required: true
|
||||
default: git.gmoker.com
|
||||
image:
|
||||
description: Image name and tag
|
||||
default: ${{ gitea.repository }}:${{ gitea.ref_name }}
|
||||
description: Image name
|
||||
required: true
|
||||
default: ${{ gitea.repository }}:latest
|
||||
username:
|
||||
description: Registry username
|
||||
required: true
|
||||
default: ${{ gitea.repository_owner }}
|
||||
password:
|
||||
description: Registry password
|
||||
required: true
|
||||
default: ${{ gitea.token }}
|
||||
tls:
|
||||
description: Prevent push to http
|
||||
required: true
|
||||
default: true
|
||||
|
||||
runs:
|
||||
using: docker
|
||||
image: Dockerfile
|
||||
args:
|
||||
- ACTION_DOCKERFILE=${{ inputs.dockerfile }}
|
||||
- ACTION_REGISTRY=${{ inputs.registry }}
|
||||
- ACTION_IMAGE=${{ inputs.image }}
|
||||
- ACTION_USERNAME=${{ inputs.username }}
|
||||
- ACTION_PASSWORD=${{ inputs.password }}
|
||||
- ACTION_TLS=${{ inputs.tls }}
|
||||
|
28
build.sh
28
build.sh
@ -1,25 +1,27 @@
|
||||
#!/bin/sh -ex
|
||||
|
||||
. ./.env || true
|
||||
# source environment from args
|
||||
eval "$*"
|
||||
|
||||
ACTION=/kaniko/executor
|
||||
|
||||
cat <<EOF > /kaniko/.docker/config.json
|
||||
{
|
||||
"auths": {
|
||||
"$GITHUB_SERVER_URL": {
|
||||
"username": "$INPUT_USERNAME",
|
||||
"password": "$INPUT_PASSWORD"
|
||||
"$ACTION_REGISTRY": {
|
||||
"username": "$ACTION_USERNAME",
|
||||
"password": "$ACTION_PASSWORD"
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
if [ -z "$IMAGEAPP" ]; then
|
||||
REGISTRY="$(echo "$GITHUB_SERVER_URL" | sed 's .*:// ')"
|
||||
IMAGEAPP="$REGISTRY/$INPUT_IMAGE"
|
||||
fi
|
||||
case "$ACTION_TLS" in
|
||||
[fF]alse) ACTION="$ACTION --insecure" ;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
/kaniko/executor \
|
||||
--cache=true \
|
||||
--context "${INPUT_DOCKERFILE%/*}" \
|
||||
--dockerfile "$INPUT_DOCKERFILE" \
|
||||
--destination "$IMAGEAPP"
|
||||
exec $ACTION \
|
||||
--context "${ACTION_DOCKERFILE%/*}" \
|
||||
--dockerfile "$ACTION_DOCKERFILE" \
|
||||
--destination "$ACTION_REGISTRY/$ACTION_IMAGE"
|
||||
|
Loading…
Reference in New Issue
Block a user