Makefile for build date

Signed-off-by: Martyn Ranyard <>
This commit is contained in:
Martyn 2020-02-21 19:07:08 +01:00
parent 06c3b47f47
commit ba1c9438f3
2 changed files with 16 additions and 3 deletions

Makefile Executable file
View File

@ -0,0 +1,14 @@
BUILD=`date +%FT%T%z`
LDFLAGS=-ldflags "-X main.buildDate=${BUILD}"
.PHONY: build deps static
go build ${LDFLAGS}
go get
CGO_ENABLED=0 GOOS=linux go build ${LDFLAGS} -a -installsuffix cgo -o karaokards .

View File

@ -2,9 +2,8 @@ FROM golang@sha256:cee6f4b901543e8e3f20da3a4f7caac6ea643fd5a46201c3c2387183a332d
RUN apk update && apk add --no-cache git make ca-certificates && update-ca-certificates
COPY main.go /go/src/
COPY internal/ /go/src/
RUN cd /go/src/; go get; CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o karaokards .
#RUN ls /go/src/ -l
COPY Makefile /go/src/
RUN cd /go/src/; make deps ; make static
FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/