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