Build environment for CleanOffer. To run maven commands, create a container with:
The source code should be copied or mounted to the container at
/usr/src/cleanoffer.
Your cloudbees credentials should be given in the environment variables
CLOUDBEES_USER and CLOUDBEES_PASSWORD
For example the following command will run mvn install on the code located
in ~/code/cleanoffer directory on the host.
docker run --rm \
-v ~/code/cleanoffer:/usr/src/cleanoffer \
-e "CLOUDBEES_USER=<username>" \
-e "CLOUDBEES_PASSWORD=<password>" \
cleanoffer/cleanoffer-build \
mvn clean install
Since the container created by the above command is short lived, the local maven repository is lost when the container is destroyed. The next time a build is run, all of the jars must be downloaded again. To preserve the local repository, simply create a container to cache the data.
docker create \
-v /root/.m2/repository \
--name="cleanoffer-maven-repo" \
busybox \
/bin/true
busybox is a good image choice since it is very small.
--volumes-from option to your run commanddocker run \
--rm \
-v ~/code/cleanoffer:/usr/src/cleanoffer \
-e "CLOUDBEES_USER=<username>" \
-e "CLOUDBEES_PASSWORD=<password>" \
--volumes-from=cleanoffer-maven-repo \
cleanoffer/cleanoffer-build \
mvn clean install
The cleanoffer-maven-repo container will persist in a stopped state until
it is deleted, but it's exported volume can be used even though the container
isn't running.
Once created the container can be used until it is no longer needed. Use
docker rm to delete the container and free up the disk space once you no
longer need it. Use the -v to delete the volume, otherwise the volume will
not be deleted when the container is deleted.
docker rm -v cleanoffer-maven-repo
Content type
Image
Digest
Size
561.2 MB
Last updated
over 7 years ago
docker pull cleanoffer/dev