@@ -3,32 +3,42 @@ FROM python:3.12-slim
33# #
44# # Install kubectl and dependencies.
55# #
6- # RUN apk add -U openssl curl tar gzip bash ca-certificates && \
7- # wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://raw.githubusercontent.com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub && \
8- # wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.23-r3/glibc-2.23-r3.apk && \
9- # apk add glibc-2.23-r3.apk && \
10- # rm glibc-2.23-r3.apk
11- # RUN curl -L -o /usr/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v1.8.0/bin/linux/amd64/kubectl && \
12- # chmod +x /usr/bin/kubectl && \
13- # kubectl version --client
146ENV KUBE_LATEST_VERSION="v1.21.3"
157ENV HELM_VERSION="v3.6.2" \
168 VIRTUAL_ENV="/app/.venv" \
179 PATH="/app/.venv/bin:$PATH"
18- RUN apt-get update
19- RUN apt-get install wget ca-certificates bash git git-crypt -y --no-install-recommends \
20- && wget -q https://storage.googleapis.com/kubernetes-release/release/${KUBE_LATEST_VERSION}/bin/linux/amd64/kubectl -O /usr/local/bin/kubectl \
10+ ENV TARGETARCH=""
11+
12+ RUN apt-get update \
13+ && apt-get install wget ca-certificates bash git git-crypt -y --no-install-recommends \
14+ # Determine target architecture and set TARGETARCH accordingly
15+ && case "$(dpkg --print-architecture)" in \
16+ amd64) export TARGETARCH="amd64" ;; \
17+ arm64) export TARGETARCH="arm64" ;; \
18+ *) echo "Unsupported architecture: $(dpkg --print-architecture)" ; exit 1 ;; \
19+ esac \
20+ \
21+ # Download kubectl
22+ && wget -q https://storage.googleapis.com/kubernetes-release/release/${KUBE_LATEST_VERSION}/bin/linux/${TARGETARCH}/kubectl -O /usr/local/bin/kubectl \
2123 && chmod +x /usr/local/bin/kubectl \
22- && wget -q https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz -O - | tar -xzO linux-amd64/helm > /usr/local/bin/helm \
24+ \
25+ # Download helm
26+ && wget -q https://get.helm.sh/helm-${HELM_VERSION}-linux-${TARGETARCH}.tar.gz -O - | tar -xzO linux-${TARGETARCH}/helm > /usr/local/bin/helm \
2327 && chmod +x /usr/local/bin/helm \
28+ \
29+ # Install helm-secrets plugin
2430 && helm plugin install https://github.com/jkroepke/helm-secrets --version v4.2.2 \
25- && wget -q https://github.com/mozilla/sops/releases/download/v3.7.3/sops-v3.7.3.linux.amd64 -O /usr/local/bin/sops \
31+ \
32+ # Download sops
33+ && wget -q https://github.com/mozilla/sops/releases/download/v3.7.3/sops-v3.7.3.linux.${TARGETARCH} -O /usr/local/bin/sops \
2634 && chmod +x /usr/local/bin/sops \
35+ \
2736 && apt-get clean \
2837 && apt-get -y autoremove \
2938 && rm -rf /var/lib/apt/lists/* \
30- && rm -rf /var/cache/apt/ \
31- ENV SHELL=/bin/bash
39+ && rm -rf /var/cache/apt/
40+
41+ ENV SHELL=/bin/bash
3242
3343# #
3444# # Install dependencies and copy GitOps server.
@@ -49,5 +59,4 @@ ENV GIT_CRYPT_KEY_FILE=/app/cluster.key
4959ENV PYTHONPATH="$PYTHONPATH:/app"
5060ENV ACCESS_LOG=""
5161
52-
53- CMD ["uvicorn" , "--host" , "0.0.0.0" , "--port" , "8000" , "gitops_server.main:app" ]
62+ CMD ["uvicorn" , "--host" , "0.0.0.0" , "--port" , "8000" , "gitops_server.main:app" ]
0 commit comments