Dockerfile (774B)
1 ### Builder stage 2 FROM golang:alpine AS builder 3 4 RUN apk update && apk add --no-cache git npm 5 COPY . $GOPATH/src/sermoni/ 6 7 # Build website files and move html.go 8 WORKDIR $GOPATH/src/sermoni/ui/ 9 RUN npm install; \ 10 npm run build; \ 11 mv $GOPATH/src/sermoni/ui/dist/html.go $GOPATH/src/sermoni/internal/http/ 12 # Build the sermoni binary 13 WORKDIR $GOPATH/src/sermoni/ 14 ENV CGO_ENABLED=0 15 ENV GOOS=linux 16 ENV GOARCH=amd64 17 RUN go get -d ./... ; \ 18 go build \ 19 -ldflags="-w -s" \ 20 -o /go/bin/sermoni \ 21 -tags PRODUCTION \ 22 ./cmd/sermoni/ 23 # Empty directory for database 24 RUN mkdir -p /data 25 ### Production image 26 FROM scratch 27 COPY --from=builder /data /data 28 COPY --from=builder /go/bin/sermoni /sermoni 29 ENTRYPOINT ["/sermoni", "-d", "/data/sermoni.db"]