|
1 |
| -FROM golang:1.14.2 |
2 |
| - |
3 |
| -LABEL maintainer="LitmusChaos" |
4 |
| - |
5 |
| -RUN apt-get update && apt-get install -y git && \ |
6 |
| - apt-get install -y ssh && \ |
7 |
| - apt install ssh rsync |
8 |
| - |
9 |
| -ARG KUBECTL_VERSION=1.18.0 |
10 |
| - |
11 |
| -#setup go envs |
12 |
| -ENV GO111MODULE=off |
13 |
| -ENV GOPATH=$HOME/go |
14 |
| -ENV PATH=$PATH:/usr/local/go/bin:$GOPATH/bin |
15 |
| - |
16 |
| -#Installing helm |
17 |
| -RUN wget https://get.helm.sh/helm-v3.4.0-linux-amd64.tar.gz && \ |
18 |
| - tar -zxvf helm-v3.4.0-linux-amd64.tar.gz && \ |
19 |
| - mv linux-amd64/helm /usr/local/bin/helm |
20 |
| - |
21 |
| -#Install kubectl |
22 |
| -ADD https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl /usr/local/bin/kubectl |
23 |
| -RUN chmod +x /usr/local/bin/kubectl |
24 |
| - |
25 |
| -#copying binaries |
26 |
| -COPY build/_output ./ |
27 |
| -COPY litmus/helm-install.sh ./ |
28 |
| -COPY build/experiment_entrypoint.sh ./ |
29 |
| - |
30 |
| -#overwrite entrypoint with test binary |
31 |
| -ENTRYPOINT ["./all-experiments"] |
| 1 | +FROM golang:alpine AS builder |
| 2 | + |
| 3 | +# Set Go environment variables |
| 4 | +ENV GO111MODULE=off |
| 5 | +ENV GOPATH=/go |
| 6 | +ENV PATH=$PATH:/usr/local/go/bin:$GOPATH/bin |
| 7 | + |
| 8 | +# Install dependencies and cleanup |
| 9 | +RUN apk update && \ |
| 10 | + apk add --no-cache \ |
| 11 | + git \ |
| 12 | + wget \ |
| 13 | + tar |
| 14 | + |
| 15 | +# Install Helm |
| 16 | +RUN wget https://get.helm.sh/helm-v3.4.0-linux-amd64.tar.gz && \ |
| 17 | + tar -zxvf helm-v3.4.0-linux-amd64.tar.gz && \ |
| 18 | + mv linux-amd64/helm /usr/local/bin/helm && \ |
| 19 | + rm -rf helm-v3.4.0-linux-amd64.tar.gz linux-amd64 |
| 20 | + |
| 21 | +# Install kubectl |
| 22 | +RUN wget https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/linux/amd64/kubectl -O /usr/local/bin/kubectl && \ |
| 23 | + chmod +x /usr/local/bin/kubectl |
| 24 | + |
| 25 | +# Copy and build the binaries |
| 26 | +COPY build/_output /app/_output |
| 27 | +COPY litmus/helm-install.sh /app/ |
| 28 | +COPY build/experiment_entrypoint.sh /app/ |
| 29 | + |
| 30 | +FROM alpine:latest |
| 31 | + |
| 32 | +# Install runtime dependencies |
| 33 | +RUN apk update && \ |
| 34 | + apk add --no-cache \ |
| 35 | + openssh-client |
| 36 | + |
| 37 | +# Copy only the necessary files from the build stage |
| 38 | +COPY --from=builder /app /app |
| 39 | +COPY --from=builder /usr/local/bin/kubectl /usr/local/bin/kubectl |
| 40 | +COPY --from=builder /usr/local/bin/helm /usr/local/bin/helm |
| 41 | + |
| 42 | +# Set working directory |
| 43 | +WORKDIR /app |
| 44 | + |
| 45 | +# Override entrypoint with test binary |
| 46 | +ENTRYPOINT ["./all-experiments"] |
0 commit comments