Allow building the test binary with the dockerfile

This commit is contained in:
David Robertson 2023-05-09 14:26:17 +01:00
parent b4bd1054d2
commit e283931767
No known key found for this signature in database
GPG Key ID: 903ECE108A39DEDD

View File

@ -3,11 +3,12 @@ FROM docker.io/golang:1.19-alpine AS base
WORKDIR /build
RUN apk --update --no-cache add build-base git
ARG BINARYNAME=syncv3
RUN --mount=target=. \
--mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
GIT_COMMIT=$(git rev-list -1 HEAD) && \
go build -ldflags "-X main.GitCommit=$GIT_COMMIT" -trimpath -o /out/ ./cmd/syncv3
go build -ldflags "-X main.GitCommit=$GIT_COMMIT" -trimpath -o /out/ "./cmd/$BINARYNAME"
FROM alpine:3.17