-
Notifications
You must be signed in to change notification settings - Fork 57
/
Dockerfile
69 lines (53 loc) · 2.06 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
FROM quay.io/centos/centos:stream9
LABEL maintainer="Carlos Camacho <carloscamachoucv@gmail.com>"
LABEL quay.expires-after=30w
ENV ANSIBLE_GATHERING smart
ENV ANSIBLE_HOST_KEY_CHECKING false
ENV ANSIBLE_RETRY_FILES_ENABLED false
ENV ANSIBLE_SSH_PIPELINING true
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
ENTRYPOINT ["ansible-playbook", "-e", "kubeinit_container_run=true"]
RUN set -x && \
\
echo "==> Configuring locales..." && \
dnf install -y glibc-langpack-en langpacks-en -y
RUN set -x && \
\
echo "==> Installing pacakges repo dependencies..." && \
curl -L -o /etc/yum.repos.d/kubeinit.repo https://download.opensuse.org/repositories/home:/kubeinit/CentOS_9_Stream/home:kubeinit.repo && \
echo "priority=1" >> /etc/yum.repos.d/kubeinit.repo && \
echo "module_hotfixes=1" >> /etc/yum.repos.d/kubeinit.repo && \
dnf --noplugins update -y && rm -rf /var/cache/yum && \
dnf upgrade -y && dnf clean all
RUN set -x && \
\
echo "==> Installing packages dependencies..." && \
dnf --noplugins install -y python python-pip openssh-clients podman jq && rm -rf /var/cache/yum && \
python3 -m pip install --user --upgrade netaddr && rm -rf /var/cache/yum && \
dnf upgrade -y && dnf clean all
ARG USER=kiuser
ARG UID=1001
ARG HOME=/home/$USER
RUN set -x && \
\
echo "==> Creating local user account..." && \
useradd --create-home --uid $UID --gid 0 $USER && \
ln -s $HOME/kubeinit/ /kubeinit
WORKDIR $HOME/kubeinit
RUN chown -R ${USER}:0 $HOME
USER $USER
ENV PATH $HOME/.local/bin:$PATH
RUN set -x && \
\
echo "==> Adding ansible and dependencies..." && \
python3 -m pip install --user --upgrade pip && \
python3 -m pip install --user --upgrade cryptography && \
python3 -m pip install --user --upgrade wheel && \
python3 -m pip install --user --upgrade ansible && \
python3 -m pip install --user --upgrade shyaml netaddr ipython dnspython
COPY --chown=${USER}:0 . .
RUN set -x && \
\
echo "==> Installing KubeInit..." && \
ansible-playbook -vv kubeinit/build-container-playbook.yml