dev_arc_aws/.forgejo/workflows/build.yml
Samuel James 2b2a809352
All checks were successful
Build & Push Images / build (push) Successful in 4m4s
CI / validate (push) Successful in 1m11s
Fix build job: install current docker-ce-cli, not stale docker.io
The first CI build failed: the job container (node:22-bookworm) installed
Debian's `docker.io` (Docker 20.10.24, API 1.41), which the host daemon
(29.x, minimum API 1.44) rejects with "client version 1.41 is too old".

Install docker-ce-cli from Docker's official apt repo instead, which is
current and talks to the daemon fine. Verified on the runner: a
node:22-bookworm container with the mounted socket + docker-ce-cli
connects to the 29.1.3 daemon (API 1.52) successfully. This also confirms
the runner's docker_host=automount is working (the client reached the
daemon; only the version was the problem).

Co-authored-by: Samuel James <ssamjame@amazon.com>
Co-authored-by: Kiro <noreply@kiro.dev>
2026-06-25 11:13:01 -04:00

72 lines
2.7 KiB
YAML

name: Build & Push Images
# Builds the frontend + backend Docker images and pushes them to the Forgejo
# container registry (registry.snsnetlabs.com/sam/...). Runs on every push to
# main, and on-demand via the "Run workflow" button (workflow_dispatch).
#
# NOTE: registry.snsnetlabs.com is the unproxied (DNS-only) registry host so
# large layers bypass Cloudflare's body cap. The web UI / packages list stays
# on forgejo.snsnetlabs.com (Cloudflare Access SSO).
#
# Requirements (see deploy/README.md):
# - Forgejo Actions secret FORGEJO_REGISTRY_TOKEN: a package-scoped token for
# user `sam`.
# - The runner must allow Docker builds: container.docker_host = "automount"
# in the forgejo-runner config (mounts /var/run/docker.sock into the job).
on:
push:
branches: [main]
workflow_dispatch:
env:
REGISTRY: registry.snsnetlabs.com
OWNER: sam
jobs:
build:
runs-on: docker
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Docker CLI
# Debian bookworm's docker.io is too old (API 1.41) for the host daemon
# (needs >= 1.44), so install the current docker-ce-cli from Docker's repo.
run: |
apt-get update
apt-get install -y --no-install-recommends ca-certificates curl
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian bookworm stable" > /etc/apt/sources.list.d/docker.list
apt-get update
apt-get install -y --no-install-recommends docker-ce-cli
docker version
- name: Log in to Forgejo registry
run: |
echo "${{ secrets.FORGEJO_REGISTRY_TOKEN }}" \
| docker login "$REGISTRY" -u "$OWNER" --password-stdin
- name: Build & push frontend image
run: |
docker build \
-t "$REGISTRY/$OWNER/archnest:${{ github.sha }}" \
-t "$REGISTRY/$OWNER/archnest:latest" \
-f Dockerfile .
docker push "$REGISTRY/$OWNER/archnest:${{ github.sha }}"
docker push "$REGISTRY/$OWNER/archnest:latest"
- name: Build & push backend image
run: |
docker build \
-t "$REGISTRY/$OWNER/archnest-backend:${{ github.sha }}" \
-t "$REGISTRY/$OWNER/archnest-backend:latest" \
-f backend/Dockerfile backend
docker push "$REGISTRY/$OWNER/archnest-backend:${{ github.sha }}"
docker push "$REGISTRY/$OWNER/archnest-backend:latest"
- name: Log out
if: always()
run: docker logout "$REGISTRY"