File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -126,6 +126,13 @@ jobs:
126126 type=raw,value=${{ github.event.client_payload.new-tag }}
127127 type=raw,value=latest
128128
129+ - name : Capture Docker build metadata
130+ id : docker_build_meta
131+ run : |
132+ echo "version=${{ github.event.client_payload.new-tag }}" >> "$GITHUB_OUTPUT"
133+ echo "commit=${GITHUB_SHA}" >> "$GITHUB_OUTPUT"
134+ echo "date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_OUTPUT"
135+
129136 - name : Build and push Docker images
130137 uses : docker/build-push-action@v6
131138 with :
@@ -134,5 +141,9 @@ jobs:
134141 push : true
135142 tags : ${{ steps.meta.outputs.tags }}
136143 labels : ${{ steps.meta.outputs.labels }}
144+ build-args : |
145+ APP_VERSION=${{ steps.docker_build_meta.outputs.version }}
146+ APP_COMMIT=${{ steps.docker_build_meta.outputs.commit }}
147+ APP_DATE=${{ steps.docker_build_meta.outputs.date }}
137148 cache-from : type=gha
138149 cache-to : type=gha,mode=max
Original file line number Diff line number Diff line change 11FROM --platform=$BUILDPLATFORM node:22-bookworm-slim AS ui-builder
22
33WORKDIR /opt/openapi-changes/html-report/ui
4- COPY html-report/ui/package.json html-report/ui/package-lock.json ./
4+ COPY html-report/ui/package.json html-report/ui/package-lock.json html-report/ui/tsconfig.json html-report/ui/vite.config.ts html-report/ui/index.html ./
5+ COPY html-report/ui/src ./src
56RUN npm ci
6- COPY html-report/ui/ ./
77RUN npm run build
88
99FROM --platform=$BUILDPLATFORM golang:1.25-bookworm AS builder
@@ -12,6 +12,9 @@ ARG TARGETPLATFORM
1212ARG BUILDPLATFORM
1313ARG TARGETOS
1414ARG TARGETARCH
15+ ARG APP_VERSION=dev
16+ ARG APP_COMMIT=unknown
17+ ARG APP_DATE=1970-01-01T00:00:00Z
1518
1619RUN mkdir -p /opt/openapi-changes
1720
@@ -21,7 +24,9 @@ COPY . ./
2124COPY --from=ui-builder /opt/openapi-changes/html-report/ui/build/ html-report/ui/build/
2225
2326RUN go mod download && go mod verify
24- RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags="-w -s" -v -o /openapi-changes openapi-changes.go
27+ RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build \
28+ -ldflags="-w -s -X main.version=${APP_VERSION} -X main.commit=${APP_COMMIT} -X main.date=${APP_DATE}" \
29+ -v -o /openapi-changes openapi-changes.go
2530
2631FROM --platform=$TARGETPLATFORM debian:bookworm-slim
2732RUN apt-get update && apt-get --yes install git && rm -rf /var/lib/apt/lists/*
You can’t perform that action at this time.
0 commit comments