You should create host volumes for workspace and development environment, which are not part of the Docker image. They will be mounted in the Docker container at runtime.
# be careful the arguments order is important
sudo docker build -t jenkins_slave .
sudo docker run \
-d \
-v pollen-dev-env:/home/pollen \
-v jenkins_workspace:/home/jenkins/workspace \
pollen-metrology/linux-jenkins-slave \
-url [master server url] \
-workDir=/home/jenkins/agent \
<agent secret hash> \
<agent name>
~
- based on Ubuntu 16.04
- install and start ssh server
- install java, download slave.jar and connect to jenkins server
- install python dependencies
- install g++ compiler and cmake
Freely inspired by: