Browse Source

Makefile for build date

Signed-off-by: Martyn Ranyard <m@rtyn.berlin>
tags/v0.0.4^2
Martyn 5 months ago
parent
commit
ba1c9438f3
2 changed files with 16 additions and 3 deletions
  1. +14
    -0
      Makefile
  2. +2
    -3
      build/package/Dockerfile

+ 14
- 0
Makefile View File

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

+ 2
- 3
build/package/Dockerfile 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/git.martyn.berlin/martyn/karaokards/
COPY internal/ /go/src/git.martyn.berlin/martyn/karaokards/internal/
RUN cd /go/src/git.martyn.berlin/martyn/karaokards/; go get; CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o karaokards .
#RUN ls /go/src/github.com/karaokards/ -l
COPY Makefile /go/src/git.martyn.berlin/martyn/karaokards/
RUN cd /go/src/git.martyn.berlin/martyn/karaokards/; make deps ; make static
FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/


Loading…
Cancel
Save