Add some other missing files to do a proper full build of the master image

This commit is contained in:
R. Tyler Croy 2017-12-20 15:25:25 -08:00
parent 36260ace9d
commit 4b5eaa4818
No known key found for this signature in database
GPG Key ID: 1426C7DC3F51E16F
4 changed files with 53 additions and 3 deletions

View File

@ -87,7 +87,7 @@ RUN for f in /usr/share/jenkins/ref/userContent/*.txt; do mv $f $f.override ; do
# Prepare the nginx instance itself
################################################################################
COPY nginx.master.conf /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d/default.conf
################################################################################
# Prepare the supervisor script to run nginx and Jenkins inside the container

28
nginx.conf Normal file
View File

@ -0,0 +1,28 @@
#
# This nginx configuration is meant to be embedded into a Jenkins master container
# for automatically routing some things
#
# Related to: https://issues.jenkins-ci.org/browse/JENKINS-46706
server {
listen 80;
location = / {
return 301 /blue/pipelines;
}
# Only allow the usage of the Blue Ocean Pipeline creation flow.
# https://github.com/CodeValet/codevalet/issues/10
location = /newJob {
return 301 /blue/organizations/jenkins/create-pipeline;
}
location / {
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://localhost:8080;
}
}

View File

@ -19,7 +19,8 @@ fi;
# Ensure ~/.m2 exists to avoid letting the Docker daemon create the directory
# owned by the root user
mkdir -p $HOME/.m2 $HOME/.npm $HOME/.cache
mkdir -p $HOME/.m2 $HOME/.npm $HOME/.cache $HOME/.config $HOME/.yarn
pushd $1
if [ -f pom.xml ]; then
@ -27,9 +28,11 @@ pushd $1
exec docker run --rm ${TTY} \
-u $(id -u):$(id -g) \
-e MAVEN_CONFIG=/var/maven/.m2 \
-v $HOME/.m2:/var/maven/.m2 \
-v $HOME/.npm:/.npm \
-v $HOME/.cache:/.cache \
-v $HOME/.m2:/var/maven/.m2 \
-v $HOME/.config:/.config \
-v $HOME/.yarn:/.yarn \
-v $PWD:/data \
-w /data \
${BUILDER_CONTAINER} \

19
supervisord.conf Normal file
View File

@ -0,0 +1,19 @@
[supervisord]
nodaemon=true
[program:nginx]
command=nginx -g "daemon off;"
autorestart=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
redirect_stderr=true
[program:jenkins]
command=/usr/local/bin/jenkins.sh
directory=/var/jenkins_home
environment=JENKINS_HOME=/var/jenkins_home,COPY_REFERENCE_FILE_LOG=$JENKINS_HOME/copy_reference_file.log
user=jenkins
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
redirect_stderr=true
startsecs=10