forked from loft-sh/vcluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.cli
31 lines (24 loc) · 822 Bytes
/
Dockerfile.cli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
FROM golang:1.19 as builder
WORKDIR /vcluster-dev
ARG TARGETOS
ARG TARGETARCH
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
COPY vendor/ vendor/
# Copy the go source
COPY cmd/vclusterctl cmd/vclusterctl
COPY pkg/ pkg/
ENV GO111MODULE on
ENV DEBUG true
# create and set GOCACHE now, this should slightly speed up the first build inside of the container
RUN mkdir -p /.cache
ENV GOCACHE=/.cache
# Build cmd
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} GO111MODULE=on go build -mod vendor -o /vcluster cmd/vclusterctl/main.go
# we use alpine for easier debugging
FROM alpine:3.16
# Set home to "/" in order to for kubectl to automatically pick up vcluster kube config
ENV KUBECONFIG=/root/.kube/config
COPY --from=builder /vcluster /usr/local/bin/vcluster
CMD /usr/local/bin/vcluster