Files
default-request-adder/Dockerfile
T
renovate 4d821d99af
default-request-adder / vulnerabilities (push) Successful in 52s
default-request-adder / test (push) Successful in 1m3s
Unbound Release / Check Preconditions (push) Successful in 27s
Unbound Release / Create Tag (push) Skipped
default-request-adder / build (push) Skipped
Unbound Release / Generate Changelog and Handle PR (push) Successful in 56s
Unbound Release / Create Release (push) Successful in 24s
Release / release (push) Successful in 15m24s
chore(deps): update golang docker tag to v1.26.7 (#362)
2026-08-19 20:04:38 +00:00

29 lines
1.1 KiB
Docker

FROM golang:1.27.0@sha256:eb37f58646a901dc7727cf448cae36daaefaba79de33b5058dab79aa4c04aefb AS deps
WORKDIR /build
ADD go.* /build
RUN go mod download
FROM deps AS build
ARG TARGETOS
ARG TARGETARCH
ENV CGO_ENABLED=0
ADD . /build
RUN if [ $(go mod tidy -v 2>&1 | grep -c unused) != 0 ]; then echo "Unused modules, please run 'go mod tidy'"; exit 1; fi
RUN go fmt ./...
RUN go vet ./...
RUN CGO_ENABLED=1 go test -mod=readonly -race -coverprofile=coverage.txt.tmp -covermode=atomic -coverpkg=$(go list ./... | tr '\n' , | sed 's/,$//') ./...
RUN ["/bin/bash", "-c", "cat coverage.txt.tmp | grep -v -f <(find . -type f | xargs grep -l 'Code generated') > coverage.txt"]
RUN go tool cover -html=coverage.txt -o coverage.html
RUN go tool cover -func=coverage.txt
RUN rm coverage.txt.tmp
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=0 go build -mod=readonly -o release/default-request-adder -ldflags '-w -s'
FROM scratch AS export
COPY --from=build /build/coverage.txt /
FROM scratch
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=build /build/release/default-request-adder /
CMD ["/default-request-adder"]