forked from jsonnet-libs/k8s
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
45 lines (31 loc) · 1.01 KB
/
Dockerfile
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
FROM golang:1.16 as base
ENV GO111MODULE=on
WORKDIR /app
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY pkg pkg
COPY main.go main.go
FROM base AS builder
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build \
-ldflags='-s -w -extldflags "-static"' \
-o k8s-gen .
FROM golang:1.16-alpine3.14 as jsonnet
RUN apk add --no-cache git
RUN go get github.com/google/go-jsonnet/cmd/jsonnet
FROM alpine:3.14
WORKDIR /app
RUN apk add --no-cache bash curl git openssh
ENV KUBECONFIG=/app/kubeconfig/kube-config.yaml
RUN chmod a+w /app
COPY --from=mikefarah/yq:4.9.6 /usr/bin/yq /usr/local/bin/yq2
COPY --from=bitnami/kubectl:1.21.2 /opt/bitnami/kubectl/bin/kubectl /usr/local/bin/
COPY --from=rancher/k3s:v1.21.2-k3s1 /bin/k3s /usr/local/bin/
COPY --from=jsonnetlibs/docsonnet:0.0.3 /usr/local/bin/docsonnet /usr/local/bin/
COPY --from=builder /app/k8s-gen /usr/local/bin/
COPY --from=jsonnet /go/bin/jsonnet /usr/local/bin/
COPY scripts .
COPY jsonnet jsonnet
COPY LICENSE .
ENTRYPOINT ["./gen.sh"]