forked from ki38sato/ansible-http
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
50 lines (40 loc) · 1.31 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
FROM python:3.5.3
ENV ANSIBLE_VERSION 2.2.0
##### ansible #####
ADD requirements.txt requirements.txt
RUN set -ex \
&& buildDeps=' \
gcc \
python-dev \
libffi-dev \
libssl-dev \
' \
&& apt-get update \
&& apt-get install -y --no-install-recommends $buildDeps \
&& apt-get install -y openssh-server sshpass git sudo \
&& rm -rf /var/lib/apt/lists/* \
&& pip install --no-cache-dir -r requirements.txt \
&& pip install ansible==$ANSIBLE_VERSION \
&& apt-get purge -y --auto-remove $buildDeps \
&& mkdir -p /etc/ansible
##### setup ansible-http #####
RUN set -x \
&& mkdir -p /ansible/work /ansible/keys /ansible/ssh \
&& groupadd -g 1001 ansible \
&& useradd -m -c "ansible user" -g ansible -s /bin/bash -d /home/ansible -u 1001 ansible \
&& mkdir -p /home/ansible/.ssh \
&& chmod 700 /home/ansible/.ssh
ADD ansible/ansible-http-go /ansible/ansible-http-go
#ADD ansible/ssh_config /home/ansible/.ssh/config
ADD ansible/sudoers_ansible /etc/sudoers.d/ansible
ADD ansible/start.sh /ansible/start.sh
RUN chown -R ansible:ansible /ansible \
&& chown -R ansible:ansible /home/ansible \
&& chmod +x /ansible/ansible-http-go \
&& chmod +x /ansible/start.sh
WORKDIR /ansible
VOLUME /ansible/keys
VOLUME /ansible/ssh
USER ansible
#CMD ["/ansible/ansible-http-go", "-c", "/ansible/config.yml"]
CMD ["./start.sh"]