d4edbef3c0
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [golang](https://hub.docker.com/_/golang) ([source](https://github.com/docker-library/golang)) | final | digest | `3e677b9` → `e1203b8` | --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMjYuMCIsInVwZGF0ZWRJblZlciI6IjQzLjEyNi4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Reviewed-on: #905 Co-authored-by: Renovate Bot <renovate@unbound.se> Co-committed-by: Renovate Bot <renovate@unbound.se>
30 lines
1.1 KiB
Docker
30 lines
1.1 KiB
Docker
FROM amd64/golang:1.26.2@sha256:e1203b85dbf84b1959b973cf4007c8cc92b9af829f3fae75c0f3ba5053cd9500 as build
|
|
WORKDIR /build
|
|
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=linux GOARCH=amd64 go build \
|
|
-tags prod \
|
|
-a -installsuffix cgo \
|
|
-mod=readonly \
|
|
-o /release/service \
|
|
-ldflags '-w -s' \
|
|
./cmd/service/service.go
|
|
|
|
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 /usr/share/zoneinfo /usr/share/zoneinfo
|
|
COPY --from=build /release/service /
|
|
CMD ["/service"]
|