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.

43 lines
2.0 KiB

  1. # Use imutable image tags rather than mutable tags (like ubuntu:20.04)
  2. FROM ubuntu:focal-20220531
  3. ARG ARCH=amd64
  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 VAGRANT_VERSION=2.3.4 \
  9. VAGRANT_DEFAULT_PROVIDER=libvirt \
  10. VAGRANT_ANSIBLE_TAGS=facts \
  11. LANG=C.UTF-8 \
  12. DEBIAN_FRONTEND=noninteractive
  13. RUN apt update && apt install -y \
  14. libssl-dev python3-dev python3-pip sshpass apt-transport-https jq moreutils libvirt-dev openssh-client rsync git \
  15. ca-certificates curl gnupg2 software-properties-common unzip \
  16. && curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \
  17. && add-apt-repository "deb [arch=$ARCH] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
  18. && apt update && apt install --no-install-recommends -y docker-ce \
  19. && apt autoremove -yqq --purge && apt clean && rm -rf /var/lib/apt/lists/*
  20. WORKDIR /kubespray
  21. COPY . .
  22. RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1 \
  23. && pip install --no-cache-dir pip -U \
  24. && pip install --no-cache-dir -r tests/requirements.txt -r requirements.txt \
  25. && KUBE_VERSION=$(sed -n 's/^kube_version: //p' roles/kubespray-defaults/defaults/main.yaml) \
  26. && curl -L https://storage.googleapis.com/kubernetes-release/release/$KUBE_VERSION/bin/linux/$ARCH/kubectl -o /usr/local/bin/kubectl\
  27. && chmod a+x /usr/local/bin/kubectl \
  28. # Install Vagrant
  29. && curl -LO https://releases.hashicorp.com/vagrant/${VAGRANT_VERSION}/vagrant_${VAGRANT_VERSION}-1_amd64.deb \
  30. && dpkg -i vagrant_${VAGRANT_VERSION}-1_amd64.deb \
  31. && rm vagrant_${VAGRANT_VERSION}-1_amd64.deb \
  32. && vagrant plugin install vagrant-libvirt \
  33. # Install Kubernetes collections
  34. && pip install --no-cache-dir kubernetes \
  35. && ansible-galaxy collection install kubernetes.core \
  36. # Clean cache python
  37. && find / -type d -name '*__pycache__' -prune -exec rm -rf {} \;