Dockerfile (765B)
1 ARG build_goarch=amd64 2 ARG build_goarm=8 3 4 ### Builder stage 5 FROM golang:alpine AS builder 6 7 RUN apk update && apk add --no-cache git npm 8 COPY . /src/ 9 10 # Build static website files 11 WORKDIR /src/ui 12 RUN mkdir -p /static 13 RUN npm install; \ 14 npm run build; 15 16 # Build binary 17 WORKDIR /src/ 18 ENV CGO_ENABLED=0 19 ENV GOOS=linux 20 ENV GOARCH=$build_goarch 21 ENV GOARM=$build_goarm 22 RUN go get -d ./... ; \ 23 go build -ldflags="-w -s" -o /go/bin/lipre . 24 25 ### Production image 26 FROM scratch 27 COPY --from=builder /go/bin/lipre /lipre 28 COPY --from=builder /src/ui/dist /ui/dist 29 ENTRYPOINT ["/lipre"] 30 # Replace the above with this when lipre is modified to take static dir arg 31 #COPY --from=builder /src/ui/dist /static 32 #ENTRYPOINT ["/lipre", "-s", "/static"] # uncomment when implemented