Files
Mukul SharmaandClaude Opus 5 6d743cbe48 Make the registry hostname configurable and drop the CA mount
buildDocker.groovy hardcoded harbor.35.238.248.203.nip.io as the push
target, so the registry could not move without editing this shared library
and every consumer moving in the same commit. It now reads
config.harbor_registry, whose default lives in homelabPipeline.groovy
beside harbor_project and every other key.

The stage errors rather than defaulting when the value is missing. Carrying
a second copy of the literal would leave two defaults free to disagree, and
an unset value would otherwise build an image named "null/<project>/<repo>"
— which docker accepts as a hostname and then fails to resolve, pointing
nowhere near the cause.

The dind pod no longer mounts the registry CA. That mount existed because
the registry was a nip.io name, which no public CA will issue for, so
cert-manager signed Harbor from a private CA; the node pool was told to
trust it for pulls, but a push comes from dockerd inside the build pod,
which has its own trust store. harbor.infra.deployshed.com carries a Let's
Encrypt certificate that both already trust, so the mount, its volume and
the whole arrangement go away rather than being repointed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LEsTefWWifp4ikvhHF5s6N
2026-09-17 09:31:32 +05:30

27 lines
1.3 KiB
Plaintext

# Fallback only — used when the repo has no Dockerfile of its own (see
# buildDocker.groovy). Simplified from the real go-Dockerfile: no SSH-keyed
# private module auth (github.com/Homelab/*), no per-module builds, no
# kafka-specific CGO toggle. Assumes a standard single-binary repo layout
# (main package at the repo root) — a repo with a different structure
# should just bring its own Dockerfile, same as demo-go-app does.
# Both stages pulled from Harbor's base-images project (mirrored from
# Docker Hub via devops-base-images), not Docker Hub directly — see that
# repo's README for the one-off mirror setup and why (build-time
# dependency on an external registry, plus wanting to pick the leanest
# variant of each deliberately rather than accept whatever a public tag
# defaults to). Only versions actually mirrored there resolve — passing
# a dockerBuildVersion whose tag isn't in devops-base-images/images.txt
# yet needs that added and re-mirrored first, unlike pulling straight
# from Docker Hub where any tag "just worked".
FROM harbor.infra.deployshed.com/base-images/golang:${version}-alpine AS build
WORKDIR /src
COPY go.mod go.sum* ./
RUN go mod download 2>/dev/null || true
COPY . .
RUN CGO_ENABLED=0 go build -o /app .
FROM harbor.infra.deployshed.com/base-images/alpine:3.20
COPY --from=build /app /app
EXPOSE 8080
ENTRYPOINT ["/app"]