ci: build images with kaniko inside the job image
CI / test (push) Successful in 1m37s
CI / chart (push) Successful in 2s
CI / image (push) Failing after 2m42s

The runner does not expose its Docker socket to job containers, so the
image job could not run docker build. Include the kaniko executor in the
CI image and build/push directly from the job; docker login only writes
the registry credentials file.

Bump the CI image tag to 2.
This commit is contained in:
TapTap committed 2026-11-13 13:52:49 +00:00
1 parent 4c6f1c8fe8
commit a0434d974f
3 files changed
+22 -14

No files matched your search

+16 -13
View File
@@ -13,13 +13,13 @@ env:
IMAGE_NAME: taptap/audiomanager
# Built by scripts/build-ci-image.sh from ci/Dockerfile. Bump the tag when
# ci/Dockerfile changes.
CI_IMAGE: gitea.tap-tap.win/taptap/audiomanager-ci:1
CI_IMAGE: gitea.tap-tap.win/taptap/audiomanager-ci:2
jobs:
test:
runs-on: ubuntu-latest
container:
image: gitea.tap-tap.win/taptap/audiomanager-ci:1
image: gitea.tap-tap.win/taptap/audiomanager-ci:2
steps:
- uses: actions/checkout@v4
- name: Test
@@ -30,7 +30,7 @@ jobs:
chart:
runs-on: ubuntu-latest
container:
image: gitea.tap-tap.win/taptap/audiomanager-ci:1
image: gitea.tap-tap.win/taptap/audiomanager-ci:2
steps:
- uses: actions/checkout@v4
- name: Lint and render the chart
@@ -44,11 +44,8 @@ jobs:
- chart
if: github.event_name == 'push'
runs-on: ubuntu-latest
# The runner executes jobs in containers; expose its Docker daemon so the
# image build works without a separate DinD service.
container:
image: gitea.tap-tap.win/taptap/audiomanager-ci:1
options: --volume /var/run/docker.sock:/var/run/docker.sock
image: gitea.tap-tap.win/taptap/audiomanager-ci:2
permissions:
contents: read
packages: write
@@ -70,12 +67,18 @@ jobs:
tags+=("$REGISTRY/$IMAGE_NAME:latest")
fi
build_args=()
destinations=()
for tag in "${tags[@]}"; do
build_args+=(-t "$tag")
destinations+=(--destination "$tag")
done
docker build "${build_args[@]}" .
for tag in "${tags[@]}"; do
docker push "$tag"
done
# Kaniko builds without a Docker daemon. docker login wrote the
# credentials to the default Docker config location.
mkdir -p /kaniko/.docker
cp "$HOME/.docker/config.json" /kaniko/.docker/config.json
kaniko-executor \
--context="dir://$PWD" \
--dockerfile="$PWD/Dockerfile" \
--snapshot-mode=redo \
"${destinations[@]}"
+5
View File
@@ -2,6 +2,8 @@
# workflows do not download a JDK or install packages on every run.
#
# Build and push it with scripts/build-ci-image.sh.
FROM gcr.io/kaniko-project/executor:v1.23.2-debug AS kaniko
FROM gradle:8.14.3-jdk21
ARG NODE_VERSION=22.14.0
@@ -42,6 +44,9 @@ RUN curl -fsSL "https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz" \
&& rm -rf /tmp/helm.tgz /tmp/linux-amd64 \
&& helm version --short
# Build images inside the job container without a Docker daemon.
COPY --from=kaniko /kaniko/executor /usr/local/bin/kaniko-executor
ENV GRADLE_USER_HOME=/root/.gradle \
JAVA_HOME=/opt/java/openjdk
+1 -1
View File
@@ -7,7 +7,7 @@ set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
IMAGE="${CI_IMAGE:-gitea.tap-tap.win/taptap/audiomanager-ci}"
TAG="${1:-1}"
TAG="${1:-2}"
docker build -f "$ROOT/ci/Dockerfile" -t "$IMAGE:$TAG" "$ROOT"
docker push "$IMAGE:$TAG"