Files
dancefetcher/Dockerfile
T
argoyle 39f77c31ce fix(docker): update base image to amd64/golang:1.24.0
Change the base image in the Dockerfile to use 
amd64/golang:1.24.0 for consistent architecture 
support across environments. This ensures better 
compatibility in the build process.
2025-02-25 21:43:35 +01:00

25 lines
1.0 KiB
Docker

FROM amd64/golang:1.24.0@sha256:4a3f1013f696a1f86314902f2c9907fe712eabc91e911cc9fde4fdc57a16d35d 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=.testCoverage.txt.tmp -covermode=atomic -coverpkg=$(go list ./... | tr '\n' , | sed 's/,$//') ./...
RUN cat .testCoverage.txt.tmp | grep -v generated.go | grep -v _gen.go > .testCoverage.txt
RUN go tool cover -html=.testCoverage.txt -o coverage.html
RUN go tool cover -func=.testCoverage.txt
RUN GOOS=linux GOARCH=amd64 go build \
-tags prod \
-a -installsuffix cgo \
-mod=readonly \
-o /release/dancefetcher \
-ldflags '-w -s' \
./cmd/dancefetcher/dancefetcher.go
FROM scratch
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=build /release/dancefetcher /
CMD ["/dancefetcher"]