summaryrefslogtreecommitdiffstats
path: root/Dockerfile
diff options
context:
space:
mode:
authorJames Munnelly <james@munnelly.eu>2019-04-29 17:55:26 +0100
committerJames Munnelly <james@munnelly.eu>2019-04-29 17:55:46 +0100
commit3935fd70e743931e6322bf088cd3e1c866f2e2cd (patch)
tree5eca322b82b303ab26b9ccb2565b38a46febfb82 /Dockerfile
parent2764e68e074ce4eb7c7ad3d6ee3aaaa59e2fd1de (diff)
downloadcert-manager-webhook-hostinger-3935fd70e743931e6322bf088cd3e1c866f2e2cd.tar.gz
cert-manager-webhook-hostinger-3935fd70e743931e6322bf088cd3e1c866f2e2cd.zip
Update Helm chart and Dockerfile
Signed-off-by: James Munnelly <james@munnelly.eu>
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile24
1 files changed, 21 insertions, 3 deletions
diff --git a/Dockerfile b/Dockerfile
index 14a64d8..70ce631 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,7 +1,25 @@
-FROM golang:1.12.1
+FROM golang:1.12.4-alpine AS build_deps
-COPY . /workspace
+RUN apk add --no-cache git
WORKDIR /workspace
-RUN go build
+ENV GO111MODULE=on
+COPY go.mod .
+COPY go.sum .
+
+RUN go mod download
+
+FROM build_deps AS build
+
+COPY . .
+
+RUN CGO_ENABLED=0 go build -o webhook -ldflags '-w -extldflags "-static"' .
+
+FROM alpine:3.9
+
+RUN apk add --no-cache ca-certificates
+
+COPY --from=build /workspace/webhook /usr/local/bin/webhook
+
+ENTRYPOINT ["webhook"]