ci: build images with kaniko inside the job image
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:
1 parent
4c6f1c8fe8
commit
a0434d974f
3 files changed
+22
-14
No files matched your search
+16
-13
@@ -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[@]}"
|
||||
Reference in new issue
Block a user