ci: probe the arm64 base by digest (throw-away branch)
All checks were successful
probe-arm / base-by-digest (push) Successful in 3m50s
All checks were successful
probe-arm / base-by-digest (push) Successful in 3m50s
This commit is contained in:
parent
e21dca50da
commit
2a8a7c7684
2 changed files with 13 additions and 36 deletions
|
|
@ -3,12 +3,12 @@ on:
|
||||||
push:
|
push:
|
||||||
branches: [ci/probe-arm]
|
branches: [ci/probe-arm]
|
||||||
jobs:
|
jobs:
|
||||||
kaniko-explicit-platform:
|
base-by-digest:
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
container:
|
container:
|
||||||
image: gcr.io/kaniko-project/executor:v1.23.2-debug
|
image: gcr.io/kaniko-project/executor:v1.23.2-debug
|
||||||
steps:
|
steps:
|
||||||
- name: arm64 with the build stages pinned to amd64
|
- name: kaniko for the runner's own platform, arm64 program, arm64 base by digest
|
||||||
env:
|
env:
|
||||||
REGISTRY_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
REGISTRY_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -16,33 +16,8 @@ jobs:
|
||||||
mkdir -p /kaniko/.docker
|
mkdir -p /kaniko/.docker
|
||||||
auth="$(printf '%s:%s' squid "$REGISTRY_TOKEN" | base64 | tr -d '\n')"
|
auth="$(printf '%s:%s' squid "$REGISTRY_TOKEN" | base64 | tr -d '\n')"
|
||||||
printf '{"auths":{"git.kmalloc.org":{"auth":"%s"}}}' "$auth" > /kaniko/.docker/config.json
|
printf '{"auths":{"git.kmalloc.org":{"auth":"%s"}}}' "$auth" > /kaniko/.docker/config.json
|
||||||
/kaniko/executor --custom-platform linux/arm64 --dockerfile Dockerfile \
|
/kaniko/executor --dockerfile Dockerfile \
|
||||||
--context "git://git.kmalloc.org/squid/sonda.git#refs/heads/ci/probe-arm" \
|
--context "git://git.kmalloc.org/squid/sonda.git#refs/heads/ci/probe-arm" \
|
||||||
--build-arg TARGETOS=linux --build-arg TARGETARCH=arm64 --build-arg VERSION=probeA \
|
--build-arg SONDA_ARCH=arm64 --build-arg VERSION=probeC \
|
||||||
--destination git.kmalloc.org/squid/sonda:probeA-arm64 --verbosity info
|
--build-arg RUNTIME_BASE=alpine@sha256:e233f2058b0628266762f745a2c17e623b418e0090f47d223909d1f9a7d4367e \
|
||||||
|
--destination git.kmalloc.org/squid/sonda:probeC-arm64 --verbosity info
|
||||||
buildah:
|
|
||||||
runs-on: docker
|
|
||||||
steps:
|
|
||||||
- name: Can buildah assemble an arm64 image here, with no daemon and no emulation?
|
|
||||||
env:
|
|
||||||
REGISTRY_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
|
||||||
run: |
|
|
||||||
set -eu
|
|
||||||
apt-get update -qq >/dev/null && apt-get install -y -qq buildah >/dev/null 2>&1
|
|
||||||
buildah --version
|
|
||||||
export STORAGE_DRIVER=vfs BUILDAH_ISOLATION=chroot
|
|
||||||
mkdir -p /tmp/ctx/data && printf '#!/bin/sh\necho hello\n' > /tmp/ctx/hello && chmod +x /tmp/ctx/hello
|
|
||||||
for arch in amd64 arm64; do
|
|
||||||
c=$(buildah from --arch "$arch" --os linux docker.io/library/alpine:3.22)
|
|
||||||
buildah copy "$c" /tmp/ctx/hello /usr/local/bin/hello
|
|
||||||
buildah copy --chown 10001:10001 "$c" /tmp/ctx/data /data
|
|
||||||
buildah config --user 10001:10001 --workingdir /data --entrypoint '["hello"]' "$c"
|
|
||||||
buildah commit "$c" "localhost/probe:$arch"
|
|
||||||
done
|
|
||||||
buildah login -u squid -p "$REGISTRY_TOKEN" git.kmalloc.org
|
|
||||||
buildah manifest create probeB
|
|
||||||
buildah manifest add probeB localhost/probe:amd64
|
|
||||||
buildah manifest add probeB localhost/probe:arm64
|
|
||||||
buildah manifest push --all probeB docker://git.kmalloc.org/squid/sonda:probeB
|
|
||||||
echo done
|
|
||||||
|
|
|
||||||
12
Dockerfile
12
Dockerfile
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# The web app: built once here, written (by its Vite config) to /src/internal/webui/dist, where the Go
|
# The web app: built once here, written (by its Vite config) to /src/internal/webui/dist, where the Go
|
||||||
# build below embeds it. Nothing of Node reaches the final image.
|
# build below embeds it. Nothing of Node reaches the final image.
|
||||||
FROM --platform=linux/amd64 node:24-alpine AS web
|
FROM node:24-alpine AS web
|
||||||
WORKDIR /src/web
|
WORKDIR /src/web
|
||||||
COPY web/package.json web/package-lock.json ./
|
COPY web/package.json web/package-lock.json ./
|
||||||
RUN npm ci
|
RUN npm ci
|
||||||
|
|
@ -12,11 +12,12 @@ RUN npm run build
|
||||||
# Build: Sonda has no CGO (SQLite, PostgreSQL and the tag reader are pure Go), so the binary
|
# Build: Sonda has no CGO (SQLite, PostgreSQL and the tag reader are pure Go), so the binary
|
||||||
# is static and the final image needs nothing but it and the CA certificates. The web app is inside it
|
# is static and the final image needs nothing but it and the CA certificates. The web app is inside it
|
||||||
# (-tags webui), so sondad serves it on / and the API on /api.
|
# (-tags webui), so sondad serves it on / and the API on /api.
|
||||||
FROM --platform=linux/amd64 golang:1.27-alpine AS build
|
FROM golang:1.27-alpine AS build
|
||||||
# Built on the machine that builds, for the machine that runs: Go crosses to another architecture with no emulation
|
# Built on the machine that builds, for the machine that runs: Go crosses to another architecture with no emulation
|
||||||
# (TARGETOS and TARGETARCH come from the platform asked for).
|
# (TARGETOS and TARGETARCH come from the platform asked for).
|
||||||
ARG TARGETOS
|
ARG TARGETOS
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
ARG SONDA_ARCH
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|
@ -26,17 +27,18 @@ COPY migrations ./migrations
|
||||||
COPY --from=web /src/internal/webui/dist ./internal/webui/dist
|
COPY --from=web /src/internal/webui/dist ./internal/webui/dist
|
||||||
# The version of the release (see .releaserc.json), as GET /version and the User-Agent of the providers say it.
|
# The version of the release (see .releaserc.json), as GET /version and the User-Agent of the providers say it.
|
||||||
ARG VERSION=dev
|
ARG VERSION=dev
|
||||||
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH:-amd64} go build -tags webui -trimpath -ldflags="-s -w -X main.version=${VERSION}" -o /out/sondad ./cmd/sondad
|
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${SONDA_ARCH:-${TARGETARCH:-amd64}} go build -tags webui -trimpath -ldflags="-s -w -X main.version=${VERSION}" -o /out/sondad ./cmd/sondad
|
||||||
|
|
||||||
# What the image has besides the program (the zones of tzdata, the user, the folders) is made here, on the machine that
|
# What the image has besides the program (the zones of tzdata, the user, the folders) is made here, on the machine that
|
||||||
# builds. The last stage then runs no command, so it can be built for another architecture with no emulation.
|
# builds. The last stage then runs no command, so it can be built for another architecture with no emulation.
|
||||||
FROM --platform=linux/amd64 alpine:3.22 AS rootfs
|
FROM alpine:3.22 AS rootfs
|
||||||
RUN apk add --no-cache tzdata \
|
RUN apk add --no-cache tzdata \
|
||||||
&& addgroup -S -g 10001 sonda \
|
&& addgroup -S -g 10001 sonda \
|
||||||
&& adduser -S -u 10001 -G sonda -h /data -H sonda \
|
&& adduser -S -u 10001 -G sonda -h /data -H sonda \
|
||||||
&& mkdir -p /out/data /out/music
|
&& mkdir -p /out/data /out/music
|
||||||
|
|
||||||
FROM alpine:3.22
|
ARG RUNTIME_BASE=alpine:3.22
|
||||||
|
FROM ${RUNTIME_BASE}
|
||||||
LABEL org.opencontainers.image.title="Sonda" \
|
LABEL org.opencontainers.image.title="Sonda" \
|
||||||
org.opencontainers.image.description="A privacy-first, self-hosted music server" \
|
org.opencontainers.image.description="A privacy-first, self-hosted music server" \
|
||||||
org.opencontainers.image.source="https://git.kmalloc.org/squid/sonda"
|
org.opencontainers.image.source="https://git.kmalloc.org/squid/sonda"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue