forked from geerlingguy/docker-ubuntu1804-ansible
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
61 lines (43 loc) · 1.68 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
FROM ubuntu:18.04
LABEL maintainer="László Hegedűs"
ENV pip_packages "pip==9.0.3 setuptools-rust"
ENV PYTHONIOENCODING UTF-8
ENV DEBIAN_FRONTEND noninteractive
# Install dependencies.
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
apt-utils \
locales \
software-properties-common \
rsyslog systemd systemd-cron sudo iproute2 \
&& rm -Rf /var/lib/apt/lists/* \
&& rm -Rf /usr/share/doc && rm -Rf /usr/share/man \
&& apt-get clean
RUN sed -i 's/^\($ModLoad imklog\)/#\1/' /etc/rsyslog.conf
# Fix potential UTF-8 errors with ansible-test.
RUN locale-gen en_US.UTF-8
RUN add-apt-repository -y ppa:deadsnakes/ppa
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
python3.8 \
python3-pip
RUN ln -s /usr/bin/python3.8 /usr/local/bin/python
#RUN ln -s /usr/bin/pip3 /usr/local/bin/pip
RUN python -m pip install -U pip setuptools setuptools-rust
RUN echo "Python: $(python --version)\n" && echo "Pip: $(pip3 --version)\n"
# Install Ansible via Pip.
#RUN pip install $pip_packages
RUN pip3 install \
ansible==2.10.7 \
PyYAML==5.4.1
COPY initctl_faker .
RUN chmod +x initctl_faker && rm -fr /sbin/initctl && ln -s /initctl_faker /sbin/initctl
# Install Ansible inventory file.
RUN mkdir -p /etc/ansible
RUN echo "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts
# Remove unnecessary getty and udev targets that result in high CPU usage when using
# multiple containers with Molecule (https://github.com/ansible/molecule/issues/1104)
RUN rm -f /lib/systemd/system/systemd*udev* \
&& rm -f /lib/systemd/system/getty.target
VOLUME ["/sys/fs/cgroup", "/tmp", "/run"]
CMD ["/lib/systemd/systemd"]