Skip to content

Commit

Permalink
docker: add Dockerfile and .dockerignore.
Browse files Browse the repository at this point in the history
The Dockerfile produces a scratch image with a statically linked binary without debug flag.
  • Loading branch information
nvanheuverzwijn committed Oct 2, 2020
1 parent 6411d31 commit 5a7e929
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*
!go.mod
!go.sum
!*.go
!Makefile
!internal/*
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM golang:1.14 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"]

0 comments on commit 5a7e929

Please sign in to comment.