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.

50 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. ARG TZ=Etc/UTC
  5. RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
  6. ENV VAGRANT_VERSION=2.2.19
  7. ENV VAGRANT_DEFAULT_PROVIDER=libvirt
  8. ENV VAGRANT_ANSIBLE_TAGS=facts
  9. RUN apt update -y \
  10. && apt install -y \
  11. libssl-dev python3-dev sshpass apt-transport-https jq moreutils wget libvirt-dev openssh-client rsync git \
  12. ca-certificates curl gnupg2 software-properties-common python3-pip unzip \
  13. && rm -rf /var/lib/apt/lists/*
  14. RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \
  15. && add-apt-repository \
  16. "deb [arch=$ARCH] https://download.docker.com/linux/ubuntu \
  17. $(lsb_release -cs) \
  18. stable" \
  19. && apt update -y && apt-get install --no-install-recommends -y docker-ce \
  20. && rm -rf /var/lib/apt/lists/*
  21. # Some tools like yamllint need this
  22. # Pip needs this as well at the moment to install ansible
  23. # (and potentially other packages)
  24. # See: https://github.com/pypa/pip/issues/10219
  25. ENV LANG=C.UTF-8
  26. WORKDIR /kubespray
  27. COPY . .
  28. RUN /usr/bin/python3 -m pip install --no-cache-dir pip -U \
  29. && /usr/bin/python3 -m pip install --no-cache-dir -r tests/requirements.txt \
  30. && python3 -m pip install --no-cache-dir -r requirements.txt \
  31. && update-alternatives --install /usr/bin/python python /usr/bin/python3 1
  32. RUN KUBE_VERSION=$(sed -n 's/^kube_version: //p' roles/kubespray-defaults/defaults/main.yaml) \
  33. && curl -LO https://storage.googleapis.com/kubernetes-release/release/$KUBE_VERSION/bin/linux/$ARCH/kubectl \
  34. && chmod a+x kubectl \
  35. && mv kubectl /usr/local/bin/kubectl
  36. # Install Vagrant
  37. RUN wget https://releases.hashicorp.com/vagrant/${VAGRANT_VERSION}/vagrant_${VAGRANT_VERSION}_x86_64.deb && \
  38. dpkg -i vagrant_${VAGRANT_VERSION}_x86_64.deb && \
  39. rm vagrant_${VAGRANT_VERSION}_x86_64.deb && \
  40. vagrant plugin install vagrant-libvirt
  41. # Install Kubernetes collections
  42. RUN pip3 install kubernetes \
  43. && ansible-galaxy collection install kubernetes.core