From 705db561ee8cb90faa697720b425a202772980c3 Mon Sep 17 00:00:00 2001 From: Arkadiusz Galwas Date: Tue, 23 Jul 2024 07:35:35 +0200 Subject: [PATCH] Dockerfile added --- hack/shoot-comparator/Dockerfile | 23 +++++++++++++++++++++++ hack/shoot-comparator/README.md | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 hack/shoot-comparator/Dockerfile diff --git a/hack/shoot-comparator/Dockerfile b/hack/shoot-comparator/Dockerfile new file mode 100644 index 00000000..12e6e284 --- /dev/null +++ b/hack/shoot-comparator/Dockerfile @@ -0,0 +1,23 @@ +FROM golang:1.22.5-alpine3.19 AS build +ARG TARGETOS +ARG TARGETARCH + +WORKDIR /workdir + +COPY go.mod go.mod +COPY go.sum go.sum +RUN go mod download + +COPY cmd/ cmd/ +COPY internal/ internal/ +COPY pkg/ pkg/ + +ARG BIN +RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o shoot-comparator cmd/main.go + +FROM gcr.io/distroless/static:nonroot +WORKDIR / +COPY --from=build /workdir/shoot-comparator . +USER 65532:65532 + +ENTRYPOINT ["/shoot-comparator"] \ No newline at end of file diff --git a/hack/shoot-comparator/README.md b/hack/shoot-comparator/README.md index d63442ba..16a16fb9 100644 --- a/hack/shoot-comparator/README.md +++ b/hack/shoot-comparator/README.md @@ -9,12 +9,12 @@ For more details, please refer to the following issues: ## Build ``` -CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o ./bin/comparator ./cmd +CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o ./bin/shoot-comparator ./cmd ``` ## Run To compare files, execute the following command: ``` -comparator files +shoot-comparator files ``` \ No newline at end of file