Files
ess-helm/Dockerfile.ci-runner
T

106 lines
3.4 KiB
Docker
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# syntax=docker/dockerfile:1
# Copyright 2024 New Vector Ltd
#
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
FROM python:3.12-slim-bookworm
ARG HELM_VERSION=3.16.2
ENV KIND_VERSION=v0.25.0
ARG KUBECONFORM_VERSION=0.6.7
ENV KUBECTL_VERSION=v1.31.0
ARG POETRY_VERSION=1.8.4
ARG YQ_VERSION=4.44.3
ARG GO_VERSION=1.23.5
ARG GOTESTFMT_VERSION=2.5.0
ARG PIPX_BIN_DIR=/usr/local/bin
RUN <<EOT bash
set -eux
apt -y update
apt -y --no-install-recommends install \
ca-certificates \
curl \
git \
pipx \
shellcheck
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
chmod a+r /etc/apt/keyrings/docker.asc
# docker
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get -y update
apt-get -y --no-install-recommends install docker-ce docker-ce-cli docker-buildx-plugin
rm -rf /var/lib/apt/lists/*
python3 --version
shellcheck --version
docker --version
# Install Go
curl -L https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz | tar -C /usr/local -xzv
export PATH=/usr/local/go/bin:$PATH
go version
# Install golangci-lint
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.63.4
golangci-lint --version
# Install gotest-fmt
curl -L https://github.com/GoTestTools/gotestfmt/releases/download/v${GOTESTFMT_VERSION}/gotestfmt_${GOTESTFMT_VERSION}_linux_amd64.tar.gz | tar -C /usr/local/bin -xvz
gotestfmt -help
# Helm
mkdir helm && pushd helm
curl -L https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz | tar -xzv
install -m u=rwx,g=rx,o=rx linux-amd64/helm /usr/local/bin/helm
popd && rm -rf helm
helm version
# Kubeconform
mkdir kubeconform && pushd kubeconform
curl -L https://github.com/yannh/kubeconform/releases/download/v${KUBECONFORM_VERSION}/kubeconform-linux-amd64.tar.gz | tar -xzv
install -m u=rwx,g=rx,o=rx kubeconform /usr/local/bin/kubeconform
popd && rm -rf kubeconform
kubeconform -v
# Kind
curl -L -o kind-linux-amd64 https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-linux-amd64
curl -L -o kind-linux-amd64.sha256sum https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-linux-amd64.sha256sum
sha256sum -c --status kind-linux-amd64.sha256sum
rm kind-linux-amd64.sha256sum
mv kind-linux-amd64 /usr/local/bin/kind
chmod +x /usr/local/bin/kind
kind --version
# kubectl
curl -L -o /usr/local/bin/kubectl https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl
chmod +x /usr/local/bin/kubectl
kubectl version --client
# yq
curl -L -o /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v${YQ_VERSION}/yq_linux_amd64 && chmod +x /usr/local/bin/yq
yq --version
useradd -rm -d /home/runner -s /bin/bash -u 1001 runner
python3 -m pip install --user pipx
python3 -m pipx ensurepath
python3 -m pipx install --global poetry==${POETRY_VERSION}
EOT
# Install pipx in user 1001 used by runAsUser of the github pod template
USER runner
RUN <<EOT bash
ls -l /usr/local/bin
pipx ensurepath
echo 'export PATH=$PATH:/usr/local/go/bin' >> $HOME/.bashrc
source ~/.bashrc
poetry --version
EOT