# 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.192.168.1.7.nip.io/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.192.168.1.7.nip.io/base-images/alpine:3.20 COPY --from=build /app /app EXPOSE 8080 ENTRYPOINT ["/app"]