Skip to content

Commit b1d2946

Browse files
authored
Merge pull request #27 from khos2ow/cleanup-readme
Update and cleanup README
2 parents 7783c0f + a3237dd commit b1d2946

File tree

1 file changed

+96
-46
lines changed

1 file changed

+96
-46
lines changed

README.md

Lines changed: 96 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
Docker images for building Apache CloudStack RPM packages.
88

9-
This will give portable, immutable and reproducable mechanism to build packages for releases. A very good candidate to be used by the Jenkins slaves of the project.
9+
This will give portable, immutable and reproducable mechanism to build packages
10+
for releases. A very good candidate to be used by the Jenkins slaves of the
11+
project.
1012

1113
## Table of Contents
1214

@@ -27,9 +29,9 @@ This will give portable, immutable and reproducable mechanism to build packages
2729

2830
## Supported tags and respective `Dockerfile` links
2931

30-
- [`latest`, `latest-jdk8`, `centos7`, `centos7-jdk8`(centos7/Dockerfile.jdk8)](https://github.com/khos2ow/cloudstack-rpm-builder/blob/master/centos7/Dockerfile.jdk8)
31-
- [`latest-jdk11`, `centos7-jdk11` (centos7/Dockerfile.jdk11)](https://github.com/khos2ow/cloudstack-rpm-builder/blob/master/centos7/Dockerfile.jdk11)
32-
- [`centos6` (centos6/Dockerfile)](https://github.com/khos2ow/cloudstack-rpm-builder/blob/master/centos6/Dockerfile) [EOL - not supported anymore]
32+
- [`latest`, `latest-jdk8`, `centos7`, `centos7-jdk8`(centos7/Dockerfile.jdk8)][centos7-dockerfile]
33+
- [`latest-jdk11`, `centos7-jdk11` (centos7/Dockerfile.jdk11)][latest-jdk11-dockerfile]
34+
- [`centos6` (centos6/Dockerfile)][centos6-dockerfile] [EOL - not supported anymore]
3335

3436
## Packages installed in container
3537

@@ -50,58 +52,83 @@ List of available packages inside the container:
5052

5153
## Build RPM packages
5254

53-
Building RPM packages with the Docker container is rather easy, a few steps are required:
55+
Building RPM packages with the Docker container is rather easy, a few steps are
56+
required:
5457

5558
### Pull Docker images
5659

57-
Let's assume we want to build packages for CentOS 7 on CentOS 7. We pull that image first:
60+
Let's assume we want to build packages for CentOS 7 on CentOS 7. We pull that
61+
image first:
5862

59-
docker pull khos2ow/cloudstack-rpm-builder:centos7-jdk11
63+
```bash
64+
docker pull khos2ow/cloudstack-rpm-builder:centos7-jdk11
65+
```
6066

61-
You can replace `centos7-jdk11` tag by [one of the other tags](#supported-tags-and-respective-dockerfile-links).
67+
You can replace `centos7-jdk11` tag by [one of the other tags].
6268

6369
### Build local repository
6470

65-
You can clone the CloudStack source code from repository locally on your machine and build packages against that.
71+
You can clone the CloudStack source code from repository locally on your machine
72+
and build packages against that.
6673

6774
#### Clone Apache CloudStack source code
6875

69-
The first step required is to clone the CloudStack source code somewhere on the filesystem, in `/tmp` for example:
76+
The first step required is to clone the CloudStack source code somewhere on the
77+
filesystem, in `/tmp` for example:
7078

71-
git clone https://github.com/apache/cloudstack.git /tmp/cloudstack
79+
```bash
80+
git clone https://github.com/apache/cloudstack.git /tmp/cloudstack
81+
```
7282

7383
Now that you have done so we can continue.
7484

7585
#### Build packages of local repository
7686

77-
Now that we have cloned the CloudStack source code locally, we can build packages by mapping `/tmp` into `/mnt/build` in the container. (Note that the container always expects the `cloudstack` code exists in `/mnt/build` path.)
87+
Now that we have cloned the CloudStack source code locally, we can build packages
88+
by mapping `/tmp` into `/mnt/build` in the container. (Note that the container
89+
always expects the `cloudstack` code exists in `/mnt/build` path.)
7890

79-
docker run \
80-
-v /tmp:/mnt/build \
81-
khos2ow/cloudstack-rpm-builder:centos7-jdk11 --distribution centos7 [ARGS...]
91+
```bash
92+
docker run \
93+
-v /tmp:/mnt/build \
94+
khos2ow/cloudstack-rpm-builder:centos7-jdk11 --distribution centos7 [ARGS...]
95+
```
8296

83-
Or if your local cloudstack folder has other name, you need to map it to `/mnt/build/cloudstack`.
97+
Or if your local cloudstack folder has other name, you need to map it to
98+
`/mnt/build/cloudstack`.
8499

85-
docker run \
86-
-v /tmp/cloudstack-custom-name:/mnt/build/cloudstack \
87-
khos2ow/cloudstack-rpm-builder:centos7-jdk11 --distribution centos7 [ARGS...]
100+
```bash
101+
docker run \
102+
-v /tmp/cloudstack-custom-name:/mnt/build/cloudstack \
103+
khos2ow/cloudstack-rpm-builder:centos7-jdk11 --distribution centos7 [ARGS...]
104+
```
88105

89-
After the build has finished the *.rpm* packages are available in */tmp/cloudstack/dist/rpmbuild/RPMS* on the host system.
106+
After the build has finished the `.rpm` packages are available in
107+
`/tmp/cloudstack/dist/rpmbuild/RPMS` on the host system.
90108

91109
### Build remote repository
92110

93-
Also you can build RPM packages 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.
111+
Also you can build RPM packages of any remote repository without the need to manually
112+
clone it first. You only need to specify git remote and git ref you intend to build
113+
from.
94114

95115
#### Build packages of remote repository
96116

97-
Now let's assume we want to build packages of `HEAD` of `master` branch from https://github.com/apache/cloudstack repository, we build packages 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.
98-
99-
docker run \
100-
-v /tmp:/mnt/build \
101-
khos2ow/cloudstack-rpm-builder:centos7-jdk11 \
102-
--git-remote https://github.com/apache/cloudstack.git \
103-
--git-ref master \
104-
--distribution centos7 [ARGS...]
117+
Now let's assume we want to build packages of `HEAD` of `master` branch from
118+
[https://github.com/apache/cloudstack] repository, we build packages by mapping
119+
`/tmp` into `/mnt/build` in the container. The container will clone the repository
120+
(defined by `--git-remote` flag) and check out the REF (defined by `--git-ref`
121+
flag) in `/mnt/build/cloudstack` inside the container and can be accessed from
122+
`/tmp/cloudstack` from the host machine.
123+
124+
```bash
125+
docker run \
126+
-v /tmp:/mnt/build \
127+
khos2ow/cloudstack-rpm-builder:centos7-jdk11 \
128+
--git-remote https://github.com/apache/cloudstack.git \
129+
--git-ref master \
130+
--distribution centos7 [ARGS...]
131+
```
105132

106133
Note that any valid git Refspec is acceptable, such as:
107134

@@ -111,41 +138,64 @@ Note that any valid git Refspec is acceptable, such as:
111138
- `refs/merge-requests/<NUMBER>/head` to build specified GitLab Merge Request
112139
- `refs/tags/<NAME>` to build specified Tag
113140

114-
After the build has finished the *.rpm* packages are available in */tmp/cloudstack/dist/rpmbuild/RPMS* on the host system.
141+
After the build has finished the `.rpm` packages are available in
142+
`/tmp/cloudstack/dist/rpmbuild/RPMS` on the host system.
115143

116144
## Building tips
117145

118146
Check the following tips when using the builder:
119147

120148
### Maven cache
121149

122-
You can provide Maven cache folder (`~/.m2`) as a volume to the container to make it run faster.
150+
You can provide Maven cache folder (`~/.m2`) as a volume to the container to make
151+
it run faster.
123152

124-
docker run \
125-
-v /tmp:/mnt/build \
126-
-v ~/.m2:/root/.m2 \
127-
khos2ow/cloudstack-rpm-builder:centos7-jdk11 --distribution centos7 [ARGS...]
153+
```bash
154+
docker run \
155+
-v /tmp:/mnt/build \
156+
-v ~/.m2:/root/.m2 \
157+
khos2ow/cloudstack-rpm-builder:centos7-jdk11 --distribution centos7 [ARGS...]
158+
```
128159

129160
### Adjust host owner permission
130161

131-
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.
162+
Builder container in some cases (e.g. using `--use-timestamp` flag) may change
163+
the file and directory owner shared from host to container (through volume) and
164+
it will create `dist` directory which holds the final artifacts. You can provide
165+
`USER_ID` (mandatory) and/or `USER_GID` (optional) from host to adjust the owner
166+
from whitin the container.
132167

133-
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.
168+
This is specially useful if you want to use this image in Jenkins job and want to
169+
clean up the workspace afterward. By adjusting the owner, you won't need to give
170+
your Jenkins' user `sudo` privilege to clean up.
134171

135-
docker run \
136-
-v /tmp:/mnt/build \
137-
-e "USER_ID=$(id -u)" \
138-
-e "USER_GID=$(id -g)" \
139-
khos2ow/cloudstack-rpm-builder:centos7-jdk11 --distribution centos7 [ARGS...]
172+
```bash
173+
docker run \
174+
-v /tmp:/mnt/build \
175+
-e "USER_ID=$(id -u)" \
176+
-e "USER_GID=$(id -g)" \
177+
khos2ow/cloudstack-rpm-builder:centos7-jdk11 --distribution centos7 [ARGS...]
178+
```
140179

141180
## Builder help
142181

143182
To see all the available options you can pass to `docker run ...` command:
144183

145-
docker run \
146-
-v /tmp:/mnt/build \
147-
khos2ow/cloudstack-rpm-builder:centos7-jdk11 --help
184+
```bash
185+
docker run \
186+
-v /tmp:/mnt/build \
187+
khos2ow/cloudstack-rpm-builder:centos7-jdk11 --help
188+
```
148189

149190
## License
150191

151-
Licensed under [Apache License version 2.0](http://www.apache.org/licenses/LICENSE-2.0). Please see the [LICENSE](https://github.com/khos2ow/cloudstack-rpm-builder/blob/master/LICENSE) file included in the root directory of the source tree for extended license details.
192+
Licensed under [Apache License version 2.0]. Please see the [LICENSE] file
193+
included in the root directory of the source tree for extended license details.
194+
195+
[centos7-dockerfile]: https://github.com/khos2ow/cloudstack-rpm-builder/blob/master/centos7/Dockerfile.jdk8
196+
[latest-jdk11-dockerfile]: https://github.com/khos2ow/cloudstack-rpm-builder/blob/master/centos7/Dockerfile.jdk11
197+
[centos6-dockerfile]: https://github.com/khos2ow/cloudstack-rpm-builder/blob/master/centos6/Dockerfile
198+
[one of the other tags]: #supported-tags-and-respective-dockerfile-links
199+
[https://github.com/apache/cloudstack]: https://github.com/apache/cloudstack
200+
[Apache License version 2.0]: http://www.apache.org/licenses/LICENSE-2.0
201+
[LICENSE]: https://github.com/khos2ow/cloudstack-rpm-builder/blob/master/LICENSE

0 commit comments

Comments
 (0)