This is a Jenkins CI server with docker in docker support (dind), espacially for building NodeJS applications and composing docker images. The main image is based on docker image from https://github.com/killercentury/docker-jenkins-dind.
Preinstalled build dependencies:
- NodeJS v8.1.4
- NPM v3.10.9
- Gulp CLI v3.9.1
- Grunt CLI v1.0.1
- Bower v1.8.0
- Sass v3.5.1
- Node Gyp v3.4.0
- NightwatchJS v0.9.9
- Docker v17.06.0
- Docker Compose v1.14.0
- Docker Machine v0.12.2
- Jenkins CI v2.34
- Oracle Java JDK v1.8.0
- Sonarqube v6.4
You can run this container by:
docker run -d \
-p 8080:8080 \
-p 9000:9000 \
--privileged \
-e DOCKER_DAEMON_ARGS="-H tcp://127.0.0.1:4243 -H unix:///var/run/docker.sock" \
--restart=always \
-v /my/jenkins/home:/var/lib/jenkins \
-v /my/sonarqube/home/conf:/var/lib/sonarqube-6.4/conf \
-v /my/sonarqube/home/data:/var/lib/sonarqube-6.4/data \
--name myJenkinsContainer \
schlechtweg/jenkins-nodejs
- runs the container;
- maps the host port 8080 (jenkins) to the container port 8080;
- maps the host port 9000 (sonarqube) to the container port 9000;
- mount jenkins volume
- mount sonarqube data and config dir volume
- to connect to an docker deamon
- sets an "always" restart policy;
- adds your docker host to the container /etc/hosts file so that Jenkins can access the Docker API
- names the image jenkins.
- prevent NPM EACCES errors cause missing permissions on mounted volumes (e.g. on nodejs git dependencies)
- the container contains a folder
/var/npm/
(owner and group is jenkins). - you can set the npm cache directory to this folder by adding an jenkins build command
npm config set cache /var/npm/cache
- the container contains a folder
- how-to persist my jenkins config?
- add jenkins home (/var/lib/jenkins) volume on docker statup command.
- All settings will be stored there
- how-to ssh public key auth outside docker container?
- create an
.ssh
directory (permission 700) in your jenkins home directory and copy your private ssh key (permission 600)
- create an