Docker images for building Apache CloudStack SystemVM Templates.
This will give portable, immutable and reproducable mechanism to build templates for releases. A very good candidate to be used by the Jenkins slaves of the project.
- Supported tags and respective
Dockerfilelinks - Packges installed in conatiner
- Build templates
- Building tips
- Builder help
- License
List of available packages inside the container:
- TODO
- rpm-build
- yum-utils
- createrepo
- mkisofs
- git
- java 1.8
- maven 3.5
- tomcat
- python
- locate
- which
Building SystemVM templates with the Docker container is rather easy, a few steps are required:
Let's assume we want to build templates based on Packer. We pull that image first:
docker pull khos2ow/cloudstack-systemvm-builder:packer
You need to replace packer tag by veewee if you are building templates for CloudStack before 4.11.x.y.
You can clone the CloudStack source code from repository locally on your machine and build templates against that.
The first step required is to clone the CloudStack source code somewhere on the filesystem, in /tmp for example:
git clone https://github.com/apache/cloudstack.git /tmp/cloudstack
Now that you have done so we can continue.
Now that we have cloned the CloudStack source code locally, we can build templates by mapping /tmp into /mnt/build in the container. (Note that the container always expects the cloudstack code exists in /mnt/build path.)
docker run \
-v /tmp:/mnt/build \
khos2ow/cloudstack-systemvm-builder:packer TODO [ARGS...]
Or if your local cloudstack folder has other name, you need to map it to /mnt/build/cloudstack.
docker run \
-v /tmp/cloudstack-custom-name:/mnt/build/cloudstack \
khos2ow/cloudstack-systemvm-builder:packer TODO [ARGS...]
After the build has finished the various formats templates are available in /tmp/cloudstack/tools/appliance/dist on the host system.
Also you can build templates of any remote repository without the need to manually clone it first. You only need to specify git remote and git ref you intend to build from.
Now let's assume we want to build templates of HEAD of master branch from https://github.com/apache/cloudstack repository, we build templates by mapping /tmp into /mnt/build in the container. The container will clone the repository (defined by --git-remote flag) and check out the REF (defined by --git-ref flag) in /mnt/build/cloudstack inside the container and can be accessed from /tmp/cloudstack from the host machine.
docker run \
-v /tmp:/mnt/build \
khos2ow/cloudstack-systemvm-builder:packer \
--git-remote https://github.com/apache/cloudstack.git \
--git-ref master \
TODO [ARGS...]
Note that any valid git Refspec is acceptable, such as:
refs/heads/<BRANCH>to build specified Branch<BRANCH>short version of build specified Branchrefs/pull/<NUMBER>/headto build specified GitHub Pull Requestrefs/merge-requests/<NUMBER>/headto build specified GitLab Merge Requestrefs/tags/<NAME>to build specified Tag
After the build has finished the various formats templates are available in /tmp/cloudstack/tools/appliance/dist on the host system.
Check the following tips when using the builder:
You can provide Maven cache folder (~/.m2) as a volume to the container to make it run faster.
docker run \
-v /tmp:/mnt/build \
-v ~/.m2:/root/.m2 \
khos2ow/cloudstack-systemvm-builder:packer TODO [ARGS...]
TODO Builder container in some cases (e.g. using --use-timestamp flag) may change the file and directory owner shared from host to container (through volume) and it will create dist directory which holds the final artifacts. You can provide USER_ID (mandatory) and/or USER_GID (optional) from host to adjust the owner from whitin the container.
This is specially useful if you want to use this image in Jenkins job and want to clean up the workspace afterward. By adjusting the owner, you won't need to give your Jenkins' user sudo privilege to clean up.
docker run \
-v /tmp:/mnt/build \
-e "USER_ID=$(id -u)" \
-e "USER_GID=$(id -g)" \
khos2ow/cloudstack-systemvm-builder:packer TODO [ARGS...]
To see all the available options you can pass to docker run ... command:
docker run \
-v /tmp:/mnt/build \
khos2ow/cloudstack-systemvm-builder:packer --help
Licensed under Apache License version 2.0. Please see the LICENSE file included in the root directory of the source tree for extended license details.