-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile_master
37 lines (30 loc) · 1.12 KB
/
Dockerfile_master
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
FROM ubuntu:16.04
MAINTAINER zerogvt
# next vars should be in our env
ARG jenkins_port
ARG jenkins_user
ARG jenkins_pass
ARG ansible_yml=jenkins-ansible.yml
RUN apt-get -y update
# install ansible from source
RUN apt-get install -y python-yaml python-jinja2 git
RUN git clone http://github.com/ansible/ansible.git --recursive /tmp/ansible
WORKDIR /tmp/ansible
ENV PATH $PATH:/tmp/ansible/bin
ENV ANSIBLE_LIBRARY /tmp/ansible/library
ENV PYTHONPATH /tmp/ansible/lib:$PYTHON_PATH
ADD inventory /etc/ansible/hosts
ADD ${ansible_yml} .
ADD inventory .
ADD nodes ./nodes/
RUN ls -la
# let ansible do the heavy lifting of installing/setting up jenkins
# use role from https://github.com/geerlingguy/ansible-role-jenkins
RUN ansible-galaxy install geerlingguy.jenkins -p ./roles/ && \
ansible-galaxy install flyapen.jenkins -p ./roles/ && \
ansible-playbook ${ansible_yml} -i inventory -c local
# expose 22 so we can ssh and inspect...
EXPOSE 22 ${jenkins_port}
# start up jenkins and let an open end command
# to keep container alive (also handy status inspection)
CMD service jenkins start && tail -f /var/log/jenkins/jenkins.log