-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdockerfile
51 lines (42 loc) · 1.56 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
FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive
ENV pip_packages "ansible"
# Install dependencies.
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
apt-utils \
build-essential \
locales \
unzip \
wget \
libffi-dev \
libssl-dev \
libyaml-dev \
python3-dev \
python3-setuptools \
python3-pip \
python3-yaml \
software-properties-common \
rsyslog systemd systemd-cron sudo iproute2 \
&& apt-get clean \
&& rm -Rf /var/lib/apt/lists/* \
&& rm -Rf /usr/share/doc && rm -Rf /usr/share/man
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
# Install Ansible via Pip.
RUN pip3 install $pip_packages
# 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/multi-user.target.wants/* \
/etc/systemd/system/*.wants/* \
/lib/systemd/system/local-fs.target.wants/* \
/lib/systemd/system/sockets.target.wants/*udev* \
/lib/systemd/system/sockets.target.wants/*initctl* \
/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup* \
/lib/systemd/system/systemd-update-utmp* \
/lib/systemd/system/getty.target
CMD [ "/lib/systemd/systemd", "log-level=info", "unit=sysinit.target" ]