You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.9 KiB

  1. # syntax=docker/dockerfile:1
  2. # Use imutable image tags rather than mutable tags (like ubuntu:22.04)
  3. FROM ubuntu:22.04@sha256:149d67e29f765f4db62aa52161009e99e389544e25a8f43c8c89d4a445a7ca37
  4. # Some tools like yamllint need this
  5. # Pip needs this as well at the moment to install ansible
  6. # (and potentially other packages)
  7. # See: https://github.com/pypa/pip/issues/10219
  8. ENV LANG=C.UTF-8 \
  9. DEBIAN_FRONTEND=noninteractive \
  10. PYTHONDONTWRITEBYTECODE=1
  11. WORKDIR /kubespray
  12. # hadolint ignore=DL3008
  13. RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
  14. apt-get update -q \
  15. && apt-get install -yq --no-install-recommends \
  16. curl \
  17. python3 \
  18. python3-pip \
  19. sshpass \
  20. vim \
  21. rsync \
  22. openssh-client \
  23. && apt-get clean \
  24. && rm -rf /var/lib/apt/lists/* /var/log/*
  25. RUN --mount=type=bind,source=requirements.txt,target=requirements.txt \
  26. --mount=type=cache,sharing=locked,id=pipcache,mode=0777,target=/root/.cache/pip \
  27. pip install --no-compile --no-cache-dir -r requirements.txt \
  28. && find /usr -type d -name '*__pycache__' -prune -exec rm -rf {} \;
  29. SHELL ["/bin/bash", "-o", "pipefail", "-c"]
  30. RUN --mount=type=bind,source=roles/kubespray-defaults/defaults/main/main.yml,target=roles/kubespray-defaults/defaults/main/main.yml \
  31. KUBE_VERSION=$(sed -n 's/^kube_version: //p' roles/kubespray-defaults/defaults/main/main.yml) \
  32. OS_ARCHITECTURE=$(dpkg --print-architecture) \
  33. && curl -L "https://dl.k8s.io/release/${KUBE_VERSION}/bin/linux/${OS_ARCHITECTURE}/kubectl" -o /usr/local/bin/kubectl \
  34. && echo "$(curl -L "https://dl.k8s.io/release/${KUBE_VERSION}/bin/linux/${OS_ARCHITECTURE}/kubectl.sha256")" /usr/local/bin/kubectl | sha256sum --check \
  35. && chmod a+x /usr/local/bin/kubectl
  36. COPY *.yml ./
  37. COPY *.cfg ./
  38. COPY roles ./roles
  39. COPY contrib ./contrib
  40. COPY inventory ./inventory
  41. COPY library ./library
  42. COPY extra_playbooks ./extra_playbooks
  43. COPY playbooks ./playbooks
  44. COPY plugins ./plugins