4917c101b3
docker-build-push / build-push (push) Successful in 5s
act_runner now runs privileged, and the job image ships docker+dockerd, so the build can happen directly in the job container. Needs vfs as the storage driver since overlay2 doesn't nest inside overlay2 on this host.
43 lines
1.4 KiB
YAML
43 lines
1.4 KiB
YAML
name: docker-build-push
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build-push:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
# act_runner's job container ships docker+dockerd but doesn't start the
|
|
# daemon itself. This host's outer Docker uses overlay2, and overlay2
|
|
# can't nest inside overlay2 (BuildKit mount fails with "invalid
|
|
# argument"), so the inner daemon has to use vfs instead — slower, no
|
|
# layer dedup, but the only storage driver that actually works nested
|
|
# here.
|
|
- name: Start Docker daemon (vfs storage driver)
|
|
run: |
|
|
dockerd --storage-driver=vfs > /tmp/dockerd.log 2>&1 &
|
|
for i in $(seq 1 30); do
|
|
docker info >/dev/null 2>&1 && break
|
|
sleep 1
|
|
done
|
|
docker info >/dev/null 2>&1 || { cat /tmp/dockerd.log; exit 1; }
|
|
|
|
- name: Build and push image
|
|
env:
|
|
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
|
run: |
|
|
SHA="${{ github.sha }}"
|
|
IMAGE="gitea.blairhaus.net/pmb/yttrx-welcomebot"
|
|
|
|
docker build -t "$IMAGE:$SHA" -t "$IMAGE:latest" .
|
|
printf '%s' "$REGISTRY_TOKEN" | docker login gitea.blairhaus.net -u pmb --password-stdin
|
|
docker push "$IMAGE:$SHA"
|
|
docker push "$IMAGE:latest"
|
|
docker logout gitea.blairhaus.net
|
|
|
|
echo "pushed $IMAGE:$SHA and $IMAGE:latest"
|