-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
97 lines (87 loc) · 3.26 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# syntax=docker/dockerfile:1
FROM --platform=$BUILDPLATFORM alpine:3.18
ARG BUILDPLATFORM
ARG BUILDARCH
ARG MINIKUBE_VERSION=1.31.0
ARG GOOGLE_CLOUD_SDK_VERSION=438.0.0
ARG KUBECTL_VERSION=1.27.3
ARG HELM_VERSION=3.12.2
ARG TERRAFORM_VERSION=1.5.3
# BUILDPLATFORM=linux/arm64/v8, BUILDARCH=arm64
RUN echo "BUILDPLATFORM=$BUILDPLATFORM, BUILDARCH=$BUILDARCH"
SHELL ["/bin/ash", "-o", "pipefail", "-c"]
# Change to tmp folder
WORKDIR /tmp
# Install dependencies
RUN set -eux; \
\
apk add --no-cache \
ca-certificates=20230506-r0 \
curl=8.2.1-r0 \
bash=5.2.15-r5 \
yq=4.33.3-r2 \
jq=1.6-r3 \
git=2.40.1-r0 \
python3=3.11.5-r0 \
&& \
\
# Install kubectl
curl -L https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/linux/${BUILDARCH}/kubectl \
-o /usr/local/bin/kubectl && \
chmod +x /usr/local/bin/kubectl && \
kubectl version --short || true && \
\
# Install Helm
curl -L https://get.helm.sh/helm-v${HELM_VERSION}-linux-${BUILDARCH}.tar.gz | tar xz && \
mv linux-${BUILDARCH}/helm /usr/local/bin/helm && \
chmod +x /usr/local/bin/helm && \
rm -rf linux-${BUILDARCH} && \
helm version && \
\
# Install Terraform
curl -LO https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_${BUILDARCH}.zip && \
unzip terraform_${TERRAFORM_VERSION}_linux_${BUILDARCH}.zip && \
rm terraform_${TERRAFORM_VERSION}_linux_${BUILDARCH}.zip && \
mv terraform /usr/local/bin/terraform && \
terraform version && \
\
# Cleanup
rm -rf /var/cache/apk/* /usr/share/doc /usr/share/man/ /usr/share/info/* /var/cache/man/* /tmp/*
# Install minikube - Separate layer to speed up builds
RUN apk add --no-cache \
openssh=9.3_p2-r0 \
gcompat=1.1.0-r1 \
libc6-compat=1.2.4-r1 \
iptables=1.8.9-r2 \
conntrack-tools=1.4.7-r1 \
&& \
\
# Install minikube
curl -LO https://github.com/kubernetes/minikube/releases/download/v${MINIKUBE_VERSION}/minikube-linux-${BUILDARCH} && \
install minikube-linux-${BUILDARCH} /usr/local/bin/minikube && \
minikube version && \
rm -rf minikube-linux-${BUILDARCH} && \
# Cleanup
rm -rf /var/cache/apk/*
# Install gcloud - Separate layer to speed up builds
WORKDIR /
ENV PATH /google-cloud-sdk/bin:$PATH
RUN export GOOGLE_CLOUD_SDK_ARCH="x86_64"; \
if [ "$BUILDARCH" = "arm64" ]; then \
export GOOGLE_CLOUD_SDK_ARCH="arm"; \
fi; \
curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-${GOOGLE_CLOUD_SDK_VERSION}-linux-${GOOGLE_CLOUD_SDK_ARCH}.tar.gz && \
tar xzf google-cloud-cli-${GOOGLE_CLOUD_SDK_VERSION}-linux-${GOOGLE_CLOUD_SDK_ARCH}.tar.gz && \
rm google-cloud-cli-${GOOGLE_CLOUD_SDK_VERSION}-linux-${GOOGLE_CLOUD_SDK_ARCH}.tar.gz && \
gcloud config set core/disable_usage_reporting true && \
gcloud config set component_manager/disable_update_check true && \
gcloud --version && \
gcloud components install gke-gcloud-auth-plugin && \
# Google Cloud CLI cleanup
find google-cloud-sdk/ -regex ".*/__pycache__" -print0 | xargs -0 rm -rf && \
rm -rf google-cloud-sdk/.install/.backup \
google-cloud-sdk/bin/anthoscli \
google-cloud-sdk/lib/googlecloudsdk/third_party/apis
WORKDIR /srv
COPY container-files/ /
COPY . .