Build the container image with the server's rootless BuildKit

The runner no longer has a Docker daemon (it gave every workflow root on
the server), and this workflow never worked anyway: it logged in to
gitea:3000, which the daemon couldn't resolve. Log in to
git.thesatelliteoflove.com and build through the BuildKit socket instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
PhilandClaude Opus 5.5 committed 2026-10-31 11:53:59 -06:00
1 parent f117913797
commit 2d0568d9c2
1 file changed
+23 -42
+23 -42
View File
@@ -1,58 +1,39 @@
# Gitea Actions workflow for StarPunk # Gitea Actions workflow for StarPunk
# Builds and pushes container images on version tags # Builds and pushes container images on version tags.
#
# The runner has no Docker daemon (that would give workflows root on the
# server). Images are built by the rootless BuildKit container next to it,
# reached through its socket.
name: Build Container name: Build Container
on: on:
# Trigger on version tags
push: push:
tags: tags:
- 'v[0-9]+.[0-9]+.[0-9]+' - 'v[0-9]+.[0-9]+.[0-9]+'
# Allow manual trigger from Gitea UI
workflow_dispatch: workflow_dispatch:
env:
REGISTRY: git.thesatelliteoflove.com
BUILDKIT: unix:///run/buildkit/buildkit/buildkitd.sock
jobs: jobs:
build: build:
runs-on: docker runs-on: docker
steps: steps:
- name: Install dependencies - name: Install dependencies
run: | run: apk add --no-cache nodejs git docker-cli docker-cli-buildx
if command -v apk > /dev/null; then
apk add --no-cache nodejs npm docker git
elif command -v apt-get > /dev/null; then
apt-get update && apt-get install -y nodejs npm docker.io git
elif command -v yum > /dev/null; then
yum install -y nodejs npm docker git
fi
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Log in to the Gitea registry
- name: Set up Docker Buildx run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login "$REGISTRY" -u "${{ github.actor }}" --password-stdin
uses: docker/setup-buildx-action@v3 - name: Use the BuildKit socket
run: docker buildx create --name ci --driver remote "$BUILDKIT" --use
- name: Extract registry URL
id: registry
run: |
# Extract hostname from server URL (remove protocol)
REGISTRY_URL=$(echo "${{ github.server_url }}" | sed 's|https://||' | sed 's|http://||')
echo "url=${REGISTRY_URL}" >> $GITHUB_OUTPUT
- name: Login to Gitea Container Registry
uses: docker/login-action@v3
with:
registry: ${{ steps.registry.outputs.url }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push - name: Build and push
uses: docker/build-push-action@v5 run: |
with: image="$REGISTRY/$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')"
context: . docker buildx build --push -f Containerfile \
file: ./Containerfile -t "$image:${{ github.ref_name }}" -t "$image:latest" .
push: true - name: Clean up
tags: | if: always()
${{ steps.registry.outputs.url }}/${{ github.repository }}:${{ github.ref_name }} run: |
${{ steps.registry.outputs.url }}/${{ github.repository }}:latest docker buildx rm ci || true
cache-from: type=gha docker logout "$REGISTRY" || true
cache-to: type=gha,mode=max