docker: add Dockerfile and .dockerignore.

The Dockerfile produces a scratch image with a statically linked binary without debug flag.
This commit is contained in:
Nicolas Vanheuverzwijn 2020-10-02 11:26:21 -04:00
parent 6411d3182f
commit f1c1110f20
2 changed files with 14 additions and 0 deletions

6
.dockerignore Normal file
View File

@ -0,0 +1,6 @@
*
!go.mod
!go.sum
!*.go
!Makefile
!internal/*

8
Dockerfile Normal file
View File

@ -0,0 +1,8 @@
FROM golang:1.15 AS builder
WORKDIR /go/src/github.com/adnanh/webhook/
COPY . ./
RUN make CGO_ENABLED=0 LDFLAGS="-w -s" build
FROM scratch
COPY --from=builder /go/src/github.com/adnanh/webhook/webhook /bin/
ENTRYPOINT ["/bin/webhook"]