-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
52 lines (33 loc) · 1.52 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
# Docker file for mounting Naevatec Jenkins server
# in order to set DOCKER_GROUP_ID variable the exp_docker_groupid.sh should be
# executed before over the same console with ". ./exp_docker_groupid.sh" and
# passed as a parameter of the build (dockergroupid)
FROM jenkins:latest
ARG dockergroupid
USER root
RUN mkdir /var/log/jenkins &&\
mkdir /var/cache/jenkins
RUN chown -R jenkins:jenkins /var/log/jenkins &&\
chown -R jenkins:jenkins /var/cache/jenkins &&\
chown -R jenkins:jenkins /var/log/jenkins
# for host access to the jenkins logs and paths configure properly
# in docker-compose.yml with volumes
#TODO: Back-up configuration
##############################
# Plugin configuration
##############################
# in order to obtain a list of plugins installed on a running jenkins use:
# $ curl -sSL "http://user:password@jenkins_url[:port]/pluginManager/api/xml?depth=1&xpath=/*/*/shortName|/*/*/version&wrapper=plugins" | perl -pe 's/.*?<shortName>([\w-]+).*?<version>([^<]+)()(<\/\w+>)+/\1 \2\n/g'|sed 's/ /:/' > plugins.txt
COPY plugins/install-plugins.sh install-plugins.sh
COPY plugins/plugins.txt plugins.txt
ENV REF_DIR .
###############################
#Docker configuration
##############################
#remember to set the proper volumes on docker-compose.yml
#add docker group to container execute to set env $DOCKER_GROUP_ID
RUN echo "**** docker_group_id= $dockergroupid *****" &&\
groupadd -g $dockergroupid docker
#add jenkins to docker group
RUN usermod -a -G docker jenkins
USER jenkins