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