docsonnet/Dockerfile
Jeroen Op 't Eynde 1f8d4c6fbf
feat: containerize (#19)
* feat: containerize

* Stripping reduces binary size, fully static linking makes the binary more portable

Co-authored-by: sh0rez <me@shorez.de>
2021-06-03 14:58:12 +02:00

19 lines
328 B
Docker

FROM golang:1.16.4 as base
ENV GO111MODULE=on
WORKDIR /app
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
FROM base AS builder
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags='-s -w -extldflags "-static"' .
FROM alpine:3.12
COPY --from=builder /app/docsonnet /usr/local/bin
ENTRYPOINT ["docsonnet"]