Skip to content

Commit f374ded

Browse files
committed
fix: use crane to extract cross-platform host-info binaries
Use crane to export platform-specific binaries from a single multi-arch image instead of pulling separate arch-tagged images, which fails when the build platform differs from the target. Also adds git commit policy to AGENTS.md - always ask before committing.
1 parent ee11f1b commit f374ded

3 files changed

Lines changed: 20 additions & 18 deletions

File tree

.github/workflows/build.yml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,9 @@ env:
1111
HOST_INFO_IMAGE: registry.v0l.io/lnvps-host-info
1212

1313
jobs:
14-
# Build host-info for multiple architectures first
14+
# Build host-info as a multi-arch image first
1515
build-host-info:
1616
runs-on: ubuntu-latest
17-
strategy:
18-
fail-fast: false
19-
matrix:
20-
include:
21-
- platform: linux/amd64
22-
tag_suffix: amd64
23-
- platform: linux/arm64
24-
tag_suffix: arm64
25-
2617
steps:
2718
- name: Checkout code
2819
uses: actions/checkout@v4
@@ -41,14 +32,14 @@ jobs:
4132
username: registry
4233
password: ${{ secrets.REGISTRY_TOKEN }}
4334

44-
- name: Build and push lnvps-host-info (${{ matrix.tag_suffix }})
35+
- name: Build and push lnvps-host-info
4536
uses: docker/build-push-action@v5
4637
with:
4738
context: .
4839
file: lnvps_host_util/Dockerfile
49-
platforms: ${{ matrix.platform }}
40+
platforms: linux/amd64,linux/arm64
5041
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
51-
tags: ${{ env.HOST_INFO_IMAGE }}:latest-${{ matrix.tag_suffix }}
42+
tags: ${{ env.HOST_INFO_IMAGE }}:latest
5243

5344
# Build main images after host-info is ready
5445
build:
@@ -94,4 +85,6 @@ jobs:
9485
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
9586
tags: ${{ matrix.image }}
9687
build-args: |
97-
HOST_INFO_IMAGE=${{ env.HOST_INFO_IMAGE }}
88+
HOST_INFO_IMAGE=${{ env.HOST_INFO_IMAGE }}:latest
89+
REGISTRY_USER=registry
90+
REGISTRY_PASS=${{ secrets.REGISTRY_TOKEN }}

AGENTS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ If the estimate is XL, create a work file in `work/` that decomposes the task in
1818

1919
**2. Check `work/`** for an active task file on the same topic before starting new work. If one exists, resume from the first unchecked task. **Never pick up a work file unless the user explicitly asks you to work on that topic.**
2020

21+
**3. Git commits** — Never auto-commit changes. Always ask the user before committing.
22+
2123
| File | Description |
2224
|---|---|
2325
| [work/agent-rules-compliance.md](work/agent-rules-compliance.md) | Bringing codebase into full compliance with all agent rules |

lnvps_api/Dockerfile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ARG IMAGE=rust:trixie
2-
ARG HOST_INFO_IMAGE=registry.v0l.io/lnvps-host-info
2+
ARG HOST_INFO_IMAGE=registry.v0l.io/lnvps-host-info:latest
33

44
FROM $IMAGE AS build
55
WORKDIR /app/src
@@ -9,12 +9,19 @@ RUN cargo test --locked --package lnvps_api -- --test-threads=1 \
99
&& cargo install --locked --root /app/build --path lnvps_api lnvps_api
1010

1111
# Download host-info binaries from pre-built multi-arch images using crane
12-
FROM gcr.io/go-containerregistry/crane:latest AS crane
12+
FROM gcr.io/go-containerregistry/crane:latest AS crane-bin
13+
FROM debian:trixie-slim AS crane
14+
RUN apt update && apt install -y ca-certificates && rm -rf /var/lib/apt/lists/*
15+
COPY --from=crane-bin /ko-app/crane /usr/local/bin/crane
1316

1417
ARG HOST_INFO_IMAGE
15-
RUN crane export --platform linux/amd64 ${HOST_INFO_IMAGE}:latest - | tar -xf - -C /tmp app/lnvps-host-info \
18+
ARG REGISTRY_USER
19+
ARG REGISTRY_PASS
20+
RUN crane auth login registry.v0l.io -u "${REGISTRY_USER}" -p "${REGISTRY_PASS}" \
21+
&& crane export --platform linux/amd64 ${HOST_INFO_IMAGE} - | tar -xf - -C /tmp app/lnvps-host-info \
1622
&& mv /tmp/app/lnvps-host-info /lnvps-host-info-amd64
17-
RUN crane export --platform linux/arm64 ${HOST_INFO_IMAGE}:latest - | tar -xf - -C /tmp app/lnvps-host-info \
23+
RUN crane auth login registry.v0l.io -u "${REGISTRY_USER}" -p "${REGISTRY_PASS}" \
24+
&& crane export --platform linux/arm64 ${HOST_INFO_IMAGE} - | tar -xf - -C /tmp app/lnvps-host-info \
1825
&& mv /tmp/app/lnvps-host-info /lnvps-host-info-arm64
1926

2027
FROM debian:trixie-slim AS runner

0 commit comments

Comments
 (0)