From 0b0e4403e433e7df0dae4470f6d36992caa5a341 Mon Sep 17 00:00:00 2001 From: D074096 Date: Wed, 6 Apr 2022 13:21:58 +0200 Subject: [PATCH] Adjust Dockerfile --- .dockerignore | 4 ++++ Dockerfile | 17 ++--------------- 2 files changed, 6 insertions(+), 15 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..ca7ae23 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +./e2e +./testbin +./.vscode +./bin diff --git a/Dockerfile b/Dockerfile index 70851e5..f2a1c2c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Build the manager binary -FROM golang:1.18 as builder +FROM golang:1.18-alpine as builder WORKDIR /workspace # Copy the Go Modules manifests @@ -9,20 +9,7 @@ COPY go.sum go.sum # and so that source changes don't invalidate our downloaded layer RUN go mod download -# Copy the go source -COPY main.go main.go -# COPY api/ api/ -COPY controllers/ controllers/ -COPY plugin/ plugin/ -COPY state/ state/ -COPY esx/ esx/ -COPY event/ event/ -COPY constants/ constants/ -COPY kubernikus/ kubernikus/ -COPY common/ common/ -COPY metrics/ metrics/ - -# Build +COPY ./ /workspace/ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go # Use distroless as minimal base image to package the manager binary