Skip to content

Commit d8c353e

Browse files
committed
Update Readme
1 parent 26cdfa8 commit d8c353e

File tree

1 file changed

+150
-1
lines changed

1 file changed

+150
-1
lines changed

README.md

Lines changed: 150 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,150 @@
1-
# cloudstack-systemvm-builder
1+
# CloudStack SystemVM Template builder using Docker
2+
3+
[![Build Status](https://travis-ci.com/khos2ow/cloudstack-systemvm-builder.svg?branch=master)](https://travis-ci.com/khos2ow/cloudstack-systemvm-builder)
4+
[![Docker Automated build](https://img.shields.io/docker/automated/khos2ow/cloudstack-systemvm-builder.svg)](https://hub.docker.com/r/khos2ow/cloudstack-systemvm-builder/)
5+
[![Docker Build Status](https://img.shields.io/docker/build/khos2ow/cloudstack-systemvm-builder.svg)](https://hub.docker.com/r/khos2ow/cloudstack-systemvm-builder/builds/)
6+
[![license](https://img.shields.io/github/license/khos2ow/cloudstack-systemvm-builder.svg)](https://github.com/khos2ow/cloudstack-systemvm-builder/blob/master/LICENSE)
7+
8+
Docker images for building Apache CloudStack SystemVM Templates.
9+
10+
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.
11+
12+
## Table of Contents
13+
14+
- [Supported tags and respective `Dockerfile` links](#supported-tags-and-respective-dockerfile-links)
15+
- [Packges installed in conatiner](#packges-installed-in-conatiner)
16+
- [Build templates](#build-templates)
17+
- [Pull Docker images](#pull-docker-images)
18+
- [Build local repository](#build-local-repository)
19+
- [Clone Apache CloudStack source code](#clone-apache-cloudstack-source-code)
20+
- [Build templates of local repository](#build-templates-of-local-repository)
21+
- [Build remote repository](#build-remote-repository)
22+
- [Build templates of remote repository](#build-templates-of-remote-repository)
23+
- [Building tips](#building-tips)
24+
- [Maven cache](#maven-cache)
25+
- [Adjust host owner permission](#adjust-host-owner-permission)
26+
- [Builder help](#builder-help)
27+
- [License](#license)
28+
29+
## Supported tags and respective `Dockerfile` links
30+
31+
- [`packer` (packer/Dockerfile)](https://github.com/khos2ow/cloudstack-systemvm-builder/blob/master/packer/Dockerfile)
32+
- [`veewee` (veewee/Dockerfile)](https://github.com/khos2ow/cloudstack-systemvm-builder/blob/master/veewee/Dockerfile)
33+
34+
## Packges installed in conatiner
35+
36+
List of available packages inside the container:
37+
38+
- rpm-build
39+
- yum-utils
40+
- createrepo
41+
- mkisofs
42+
- git
43+
- java 1.8
44+
- maven 3.5
45+
- tomcat
46+
- python
47+
- locate
48+
- which
49+
50+
## Build templates
51+
52+
Building SystemVM templates with the Docker container is rather easy, a few steps are required:
53+
54+
### Pull Docker images
55+
56+
Let's assume we want to build templates based on Packer. We pull that image first:
57+
58+
docker pull khos2ow/cloudstack-systemvm-builder:packer
59+
60+
You can replace `packer` tag by `veewee` if you are building templates for CloudStack before 4.11.x.
61+
62+
### Build local repository
63+
64+
You can clone the CloudStack source code from repository locally on your machine and build templates against that.
65+
66+
#### Clone Apache CloudStack source code
67+
68+
The first step required is to clone the CloudStack source code somewhere on the filesystem, in `/tmp` for example:
69+
70+
git clone https://github.com/apache/cloudstack.git /tmp/cloudstack
71+
72+
Now that you have done so we can continue.
73+
74+
#### Build templates of local repository
75+
76+
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.)
77+
78+
docker run \
79+
-v /tmp:/mnt/build \
80+
khos2ow/cloudstack-systemvm-builder:packer TODO [ARGS...]
81+
82+
Or if your local cloudstack folder has other name, you need to map it to `/mnt/build/cloudstack`.
83+
84+
docker run \
85+
-v /tmp/cloudstack-custom-name:/mnt/build/cloudstack \
86+
khos2ow/cloudstack-systemvm-builder:packer TODO [ARGS...]
87+
88+
After the build has finished the *various formats* packages are available in */tmp/cloudstack/tools/appliance/dist* on the host system.
89+
90+
### Build remote repository
91+
92+
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.
93+
94+
#### Build templates of remote repository
95+
96+
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.
97+
98+
docker run \
99+
-v /tmp:/mnt/build \
100+
khos2ow/cloudstack-systemvm-builder:packer \
101+
--git-remote https://github.com/apache/cloudstack.git \
102+
--git-ref master \
103+
TODO [ARGS...]
104+
105+
Note that any valid git Refspec is acceptable, such as:
106+
107+
- `refs/heads/<BRANCH>` to build specified Branch
108+
- `<BRANCH>` short version of build specified Branch
109+
- `refs/pull/<NUMBER>/head` to build specified GitHub Pull Request
110+
- `refs/merge-requests/<NUMBER>/head` to build specified GitLab Merge Request
111+
- `refs/tags/<NAME>` to build specified Tag
112+
113+
After the build has finished the *various formats* packages are available in */tmp/cloudstack/tools/appliance/dist* on the host system.
114+
115+
## Building tips
116+
117+
Check the following tips when using the builder:
118+
119+
### Maven cache
120+
121+
You can provide Maven cache folder (`~/.m2`) as a volume to the container to make it run faster.
122+
123+
docker run \
124+
-v /tmp:/mnt/build \
125+
-v ~/.m2:/root/.m2 \
126+
khos2ow/cloudstack-systemvm-builder:packer TODO [ARGS...]
127+
128+
### Adjust host owner permission
129+
130+
**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.
131+
132+
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.
133+
134+
docker run \
135+
-v /tmp:/mnt/build \
136+
-e "USER_ID=$(id -u)" \
137+
-e "USER_GID=$(id -g)" \
138+
khos2ow/cloudstack-systemvm-builder:packer TODO [ARGS...]
139+
140+
## Builder help
141+
142+
To see all the available options you can pass to `docker run ...` command:
143+
144+
docker run \
145+
-v /tmp:/mnt/build \
146+
khos2ow/cloudstack-systemvm-builder:packer --help
147+
148+
## License
149+
150+
Licensed under [Apache License version 2.0](http://www.apache.org/licenses/LICENSE-2.0). Please see the [LICENSE](https://github.com/khos2ow/cloudstack-systemvm-builder/blob/master/LICENSE) file included in the root directory of the source tree for extended license details.

0 commit comments

Comments
 (0)