-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.jenkins
30 lines (29 loc) · 1.46 KB
/
Dockerfile.jenkins
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
FROM jenkins/jenkins:lts
# Help from https://docs.cloudbees.com/docs/cloudbees-jenkins-distribution/latest/distro-admin-guide/customize-in-docker
USER root
# Move the home folder for jenkins due to the original jenkins image using volumes. Any changes we make
# underneath /var/jenkins_home are lost. This way we can stage jobs.
RUN cp -ar /var/jenkins_home /home/jenkins
COPY jobs /home/jenkins/jobs/
RUN chown -R jenkins:jenkins /home/jenkins/jobs && chmod -R 755 /home/jenkins/jobs
#deploy plugins ahead of time
USER jenkins
COPY jenkins.plugins /usr/share/jenkins/plugins.txt
COPY jenkins.configurationascode /home/jenkins/jenkins_casc.yaml
ADD https://deb.nodesource.com/setup_14.x /nodejs.script
RUN /usr/local/bin/install-plugins.sh < /usr/share/jenkins/plugins.txt
# we don't need any of this outside of the user jenkins line anymore
# but keeping it for references.
# learned safe path for configuration as code file placement from here
# https://plugins.jenkins.io/configuration-as-code/
#RUN chown jenkins:jenkins /var/jenkins_home/jenkins_casc.yaml
#ARG API_KEY
#RUN chmod +x /nodejs.script && \
# (cd /; ./nodejs.script) && \
# apt-get install -y nodejs && \
# npm install snyk
USER jenkins
#commenting this out for now - this causes issues because it writes to /var/jenkins_home/config/snyk/,
#which is inside a volume /var/jenkins_home, therefore the changes aren't captured by docker on build
#RUN echo api-key=$API_KEY && \
# /node_modules/.bin/snyk auth ${API_KEY}