kaniko/.forgejo/workflows/docker-dev.yaml
Guillaume B.B. Van Hemmen ddad91c367 - Add custom Kaniko builder and CI workflows ()
Introduce a custom Kaniko-based image for OCI container builds, including a wrapper script (`build.sh`) for flexible execution. Added Forgejo CI workflows for PR, branch, and tag builds, along with detailed documentation in the updated README. Licensed under Apache 2.0.

Reviewed-on: 
Co-authored-by: Guillaume B.B. Van Hemmen <GuillaumeHemmen@noreply.git.van-hemmen.com>
Co-committed-by: Guillaume B.B. Van Hemmen <GuillaumeHemmen@noreply.git.van-hemmen.com>
2025-05-19 09:48:07 +00:00

65 lines
2 KiB
YAML

# dev: docker build + upload branch name
# pr: docker build + upload branch name
# tag: docker build tag version+latest
on:
push:
branches-ignore:
- 'master'
jobs:
docker-dev:
runs-on: docker
container:
image: gcr.io/kaniko-project/executor:debug
steps:
- name: setup docker config
env:
REGISTRY_HOST: git.van-hemmen.com
REGISTRY_USER: ${{ secrets.docker_username }}
REGISTRY_PASS: ${{ secrets.access_token }}
run: |
mkdir -p /kaniko/.docker
cat > /kaniko/.docker/config.json <<EOF
{
"auths": {
"${REGISTRY_HOST}": {
"username": "${REGISTRY_USER}",
"password": "${REGISTRY_PASS}"
}
}
}
EOF
- name: build and push
env:
GIT_USERNAME: ${{ secrets.docker_username }}
GIT_PASSWORD: ${{ secrets.access_token }}
KANIKO_CONTEXT: git://git.van-hemmen.com/actions/kaniko.git
KANIKO_DESTINATION: git.van-hemmen.com/actions/kaniko:${GITHUB_SHA}
KANIKO_DOCKERFILE: ./Dockerfile
KANIKO_VERBOSITY: info
run: |
# ----- build a list of --destination flags -------------------------
OLD_IFS="$IFS"; IFS=',' # split on commas
DEST_FLAGS=""
for raw in $KANIKO_DESTINATION; do
# trim possible whitespace
raw=$(echo "$raw" | xargs)
# expand any ${VAR} / $VAR placeholders safely
expanded=$(eval echo "$raw")
[ -n "$expanded" ] && DEST_FLAGS="$DEST_FLAGS --destination=$expanded"
done
IFS="$OLD_IFS"
# -------------------------------------------------------------------
echo "Kaniko will be called with:$DEST_FLAGS"
/kaniko/executor \
--verbosity="$KANIKO_VERBOSITY" \
--context="$KANIKO_CONTEXT#$GITHUB_REF_NAME" \
--dockerfile="$KANIKO_DOCKERFILE" \
$DEST_FLAGS