-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
77 lines (60 loc) · 2.4 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
70
71
72
73
74
75
76
77
ARG VER
FROM debian:$VER
LABEL maintainer="Sultan Gillani (sultangillani)"
ENV DEBIAN_FRONTEND noninteractive
ENV pip_packages "ansible cryptography yamllint ansible-lint"
# Install dependencies.
WORKDIR /usr/local/bin
RUN apt-get update && apt-get install -y --no-install-recommends \
gnupg2 \
python3-pip \
python3-dev \
build-essential \
aptitude \
software-properties-common \
rsyslog \
systemd \
systemd-cron \
sudo \
openssl \
ca-certificates \
&& ln -s /usr/bin/python3 /usr/bin/python \
&& pip3 install --upgrade pip setuptools \
&& 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
# Cleanup unwanted systemd files -- See https://hub.docker.com/_/centos/
RUN find /lib/systemd/system/sysinit.target.wants/* ! -name systemd-tmpfiles-setup.service -delete; \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*;
# JDK Issue not sure whats up
RUN mkdir -p /usr/share/man/man1
# Install Ansible via Pip.
RUN pip install $pip_packages
COPY ansible-playbook-wrapper /usr/local/bin/
RUN useradd -rm -d /etc/ansible --shell /bin/bash ansible \
&& chown -R ansible:ansible /etc/ansible \
&& printf "[local]\nlocalhost ansible_connection=local" > /etc/ansible/hosts \
&& printf "ansible ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
USER ansible
RUN mkdir -p /etc/ansible/roles
WORKDIR /etc/ansible/roles/roles_to_test
ENV ANSIBLE_LIBRARY=${ANSIBLE_LIBRARY} \
ANSIBLE_VERBOSITY=${ANSIBLE_VERBOSITY} \
ANSIBLE_ROLES_PATH=${ANSIBLE_ROLES_PATH} \
ANSIBLE_HOST_KEY_CHECKING=${ANSIBLE_HOST_KEY_CHECKING} \
ANSIBLE_LOG_PATH=${ANSIBLE_LOG_PATH} \
ANSIBLE_EXECUTABLE=${ANSIBLE_EXECUTABLE} \
ANSIBLE_BECOME=${ANSIBLE_BECOME} \
ANSIBLE_BECOME_USER=${ANSIBLE_BECOME_USER} \
ANSIBLE_PIPELINING=${ANSIBLE_PIPELINING} \
ANSIBLE_INVENTORY=${ANSIBLE_INVENTORY} \
ANSIBLE_INVENTORY_ENABLED=${ANSIBLE_INVENTORY_ENABLED} \
TTY=${TTY}
VOLUME ["/sys/fs/cgroup", "/etc/ansible/roles/roles_to_test", "/tmp"]
CMD ["bash"]