feat: containerize (#19)

* feat: containerize

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

Co-authored-by: sh0rez <me@shorez.de>
This commit is contained in:
Jeroen Op 't Eynde 2021-06-03 14:58:12 +02:00 committed by GitHub
parent 3e1757637e
commit 1f8d4c6fbf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 47 additions and 15 deletions

19
Dockerfile Normal file
View file

@ -0,0 +1,19 @@
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"]