-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
95 lines (79 loc) · 3.13 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
FROM jenkins/jenkins:2.118-slim
MAINTAINER thomas.steinbach iteratec.de
USER root
RUN apt-get update && \
apt-get upgrade -y && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
libssl-dev \
libffi-dev \
python-dev \
python-setuptools \
sudo \
git \
ruby \
ruby-dev \
rake \
apt-transport-https \
netcat && \
apt-key adv \
--keyserver hkp://p80.pool.sks-keyservers.net:80 \
--recv-keys 58118E89F3A912897C070ADBF76221572C52609D && \
echo 'deb https://apt.dockerproject.org/repo debian-jessie main' > /etc/apt/sources.list.d/docker.list && \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y docker-engine && \
apt-get clean && \
apt-get autoremove
RUN easy_install pip && \
gem install docker-api inspec
RUN pip install setuptools \
ansible==2.4.4.0 \
docker-py==1.10.6 \
ansible-lint==3.4.21 \
awscli
# install required Jenkins PlugIns
COPY files/mod_jenkins/plugins.txt /usr/share/jenkins/ref/plugins.txt
RUN /usr/local/bin/install-plugins.sh < /usr/share/jenkins/ref/plugins.txt
# configure Ansible
RUN mkdir /etc/ansible && \
echo 'localhost ansible_connection=local' >> /etc/ansible/hosts
# setup custom Ansible installation from sources
RUN mkdir /ansible_custom && \
cd /ansible_custom && \
git clone https://github.com/ansible/ansible.git . --recursive
# modify Ansible installation
COPY files/mod_ansible/profile_tasks.py /usr/local/lib/python2.7/dist-packages/ansible/plugins/callback/profile_tasks.py
# copy AnsibleCI static content to Jenkins
COPY files/jenkinsdata/jenkins_home /usr/share/jenkins/ref
COPY files/jenkinsdata/ansible-ci /usr/share/jenkins/ref/ansible-ci
# copy AnsibleCI setup scripts
RUN mkdir /ansible_data
COPY files/ansibledata /ansible_data
# copy AnsibleCI default and example configuration files
RUN mkdir /ansible_config /example_config
COPY files/exampleconfig /example_config
# create empty config stubs
RUN mkdir /used_config && \
touch /used_config/aci.yml && \
touch /used_config/agents.yml && \
touch /used_config/prelive.yml && \
touch /used_config/repositories.yml && \
touch /used_config/vault.yml
# copy system and tool scripts
COPY files/system/start.sh /usr/local/bin/start.sh
COPY files/system/start-root.sh /usr/local/bin/start-root.sh
COPY files/system/local_setup.sh /usr/local/bin/local_setup.sh
COPY files/system/server_setup.sh /usr/local/bin/server_setup.sh
# add jenkins to sudoers
RUN usermod -a -G sudo jenkins && \
echo 'jenkins ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/jenkins-nopasswd
# set rights and permissions
RUN chown -R jenkins:jenkins /used_config && \
chown -R jenkins:jenkins /ansible_custom && \
chmod 0755 /usr/local/bin/start.sh && \
chmod 0755 /usr/local/bin/start-root.sh && \
chmod 0755 /usr/local/bin/local_setup.sh && \
chmod 0755 /usr/local/bin/server_setup.sh && \
chmod 0644 /usr/local/lib/python2.7/dist-packages/ansible/plugins/callback/profile_tasks.py
WORKDIR /ansible_config
ENTRYPOINT ["/usr/local/bin/start-root.sh"]