From b7fe40d00f64b7e67c998c36ab4d75e963ab1103 Mon Sep 17 00:00:00 2001 From: Mario Pander Date: Tue, 15 Sep 2026 13:35:59 -0400 Subject: [PATCH] Inject version build-arg into Docker image --- .gitignore | 3 +++ Dockerfile | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 219c011..ce414eb 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,6 @@ secrets.json # Private/internal files .private/ + +# Local Tekton PipelineRuns (ECR details, not for upstream) +.tekton/ diff --git a/Dockerfile b/Dockerfile index 11956e1..4337230 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,10 @@ # Build stage FROM golang:1.21-alpine AS builder +ARG VERSION=dev +ARG COMMIT=none +ARG DATE=unknown + WORKDIR /app # Copy go mod files @@ -11,7 +15,9 @@ RUN go mod download COPY . . # Build -RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o cryptoscan ./cmd/cryptoscan +RUN CGO_ENABLED=0 GOOS=linux go build \ + -ldflags="-s -w -X main.version=${VERSION} -X main.commit=${COMMIT} -X main.date=${DATE}" \ + -o cryptoscan ./cmd/cryptoscan # Runtime stage FROM alpine:3.19