Skip to content

Commit f1c1110

Browse files
docker: add Dockerfile and .dockerignore.
The Dockerfile produces a scratch image with a statically linked binary without debug flag.
1 parent 6411d31 commit f1c1110

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*
2+
!go.mod
3+
!go.sum
4+
!*.go
5+
!Makefile
6+
!internal/*

Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM golang:1.15 AS builder
2+
WORKDIR /go/src/github.com/adnanh/webhook/
3+
COPY . ./
4+
RUN make CGO_ENABLED=0 LDFLAGS="-w -s" build
5+
6+
FROM scratch
7+
COPY --from=builder /go/src/github.com/adnanh/webhook/webhook /bin/
8+
ENTRYPOINT ["/bin/webhook"]

0 commit comments

Comments
 (0)