forked from kalantar/etc3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.taskrunner
More file actions
57 lines (45 loc) · 2.02 KB
/
Dockerfile.taskrunner
File metadata and controls
57 lines (45 loc) · 2.02 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
# Build the handler and install helm and kubectl
FROM golang:1.16-buster as builder
WORKDIR /workspace
# Copy the go source
COPY ./ ./
# COPY api/ api/
# COPY controllers/ controllers/
# COPY go.mod go.mod
# COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download
# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o /bin/taskrunner taskrunner/main.go
# Install kubectl
RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
RUN chmod 755 kubectl
RUN cp kubectl /bin
# Install Helm 3
RUN curl -fsSL -o helm-v3.5.0-linux-amd64.tar.gz https://get.helm.sh/helm-v3.5.0-linux-amd64.tar.gz
RUN tar -zxvf helm-v3.5.0-linux-amd64.tar.gz
RUN linux-amd64/helm version
# Install Kustomize v3
RUN curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
RUN cp kustomize /bin
# Install Fortio
RUN GOBIN=/bin go get fortio.org/fortio@v1.17.0
# Install yq
RUN GO111MODULE=on GOBIN=/bin go get github.com/mikefarah/yq/v4
# Small linux image with useful shell commands
FROM debian:buster-slim
WORKDIR /
COPY --from=builder /bin/taskrunner /bin/taskrunner
COPY --from=builder /bin/kubectl /bin/kubectl
COPY --from=builder /bin/kustomize /bin/kustomize
COPY --from=builder /workspace/linux-amd64/helm /bin/helm
COPY --from=builder /bin/fortio /bin/fortio
COPY --from=builder /bin/yq /bin/yq
RUN mkdir /scratch
# Install git
RUN apt-get update && apt-get install -y git curl gpg
# Install GH CLI
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null
RUN apt update && apt install gh