Skip to content

Commit 69840ca

Browse files
committed
Add rocky8.v1
1 parent 46f52ca commit 69840ca

File tree

7 files changed

+128
-13
lines changed

7 files changed

+128
-13
lines changed

README.md

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ This repository maintains the Dockerfile and scripts to build Apache CloudStack
66

77
| **Dockerfile** | **CloudStack versions** | **Note** |
88
|---------------------|-------------------------------|----------------------|
9-
| ubuntu2204.v1 | 4.18.x, 4.19.x | For Ubuntu distros |
10-
| rocky8.v1 | 4.18.x, 4.19.x | For RHEL/Rocky Linux/AlmaLinux/OracleLinux distros |
9+
| ubuntu2204.v1 | 4.18.x, 4.19.x | DEB packages for Ubuntu distros |
10+
| rocky8.v1 | 4.18.x, 4.19.x | RPM packages for RHEL/Rocky Linux/AlmaLinux/OracleLinux distros |
1111

1212
## Usage
1313

@@ -30,13 +30,16 @@ Below are configurations in the configuration file.
3030

3131
| **Variablies** | **Description** | **Note** |
3232
|---------------------|-------------------------------|----------------------|
33-
| `SOURCE` | The directory where the source code is, or the URL of the git repository. | Mounted to /source/ if it is a directory. |
34-
| `OUTPUT` | The directory where the packages will be in. | Mounted to /output/ in the docker container. |
35-
| `SUDO` | Please set to `sudo` if you use a non-root user | Default: None. |
36-
| `VERSION` | The CloudStack version, branch name or commit SHA | Default: None. |
37-
| `BUILD_OPTS` | The build options. Refer to `Build Options` | Default: None. |
33+
| `SOURCE` | The directory where the source code is, or the URL of the git repository. | Mounted to /source/ if it is a directory |
34+
| `OUTPUT` | The directory where the packages will be in. | Mounted to /output/ in the docker container |
35+
| `SUDO` | Please set to `sudo` if you use a non-root user | Default: None |
36+
| `VERSION` | The CloudStack version, branch name or commit SHA | Default: None |
37+
| `BUILD_OPTS` | The build options. Refer to `Build Options` | Default: `"-Dnoredist -DskipTests -Dsystemvm-kvm -Dsystemvm-xen -Dsystemvm-vmware"` |
38+
| `PACKAGE_OPTS` | The options for `package.sh` (RPM only) | Default: None |
3839

39-
A sample of environment variables can be found at `config.ubuntu.sample`.
40+
Samples of environment variables can be found at
41+
- `config.ubuntu.sample`
42+
- `config.rocky8.sample`
4043

4144
### 2. Build packages with parameters
4245

@@ -108,11 +111,23 @@ $SUDO docker run -ti \
108111

109112
| **OS** | **Option** | **Note** |
110113
|-------------|--------------------|----------------------|
111-
| Ubuntu | -Dnoredist | Support non-Open Source Software (e.g. VMware) |
114+
| Ubuntu/Rocky8 | -Dnoredist | Support non-Open Source Software (e.g. VMware) |
112115
| | -DskipTests | Skip unit tests |
113116
| | -Dsystemvm-kvm | Bundle with SystemVM template for KVM |
114117
| | -Dsystemvm-vmware | Bundle with SystemVM template for VMware |
115118
| | -Dsystemvm-xen | Bundle with SystemVM template for XenServer/XCP-ng |
116119

117120

118-
The default value for ubuntu images is `-Dnoredist -DskipTests -Dsystemvm-kvm -Dsystemvm-xen -Dsystemvm-vmware`
121+
The default value is `-Dnoredist -DskipTests -Dsystemvm-kvm -Dsystemvm-xen -Dsystemvm-vmware`
122+
123+
## Package Options (RPM only)
124+
125+
More details for RPM build can be found at https://github.com/apache/cloudstack/blob/main/packaging/package.sh
126+
127+
| **OS** | **Option** | **Note** |
128+
|-------------|--------------------|----------------------|
129+
| Rocky 8 | -p, --pack | Define which type of libraries to package ("oss"|"OSS"|"noredist"|"NOREDIST") (default "oss") |
130+
| | -T, --use-timestamp | Use epoch timestamp instead of SNAPSHOT in the package name (if not provided, use "SNAPSHOT") |
131+
| | -t, --templates | Passes necessary flag to package the required templates. Comma separated string - kvm,xen,vmware,ovm,hyperv |
132+
133+
The default value for rocky images is ``

build.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ if [ "$DRY_RUN" = "yes" ];then
8686
echo "COMMAND is: ${COMMAND}"
8787
else
8888
echo "Running command: ${COMMAND}"
89+
NOW="$(date +'%Y%m%d-%H%M%S')"
8990
${COMMAND}
91+
$SUDO docker stop $CONTAINER_NAME || true
92+
$SUDO docker logs $CONTAINER_NAME > $NOW-$CONTAINER_NAME.log
9093
$SUDO docker rm $CONTAINER_NAME
9194
fi

config.rocky8.sample

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
# The repository of the image. Default is weizhouapache/cloudstack-builder
3+
REPO=weizhouapache/cloudstack-builder
4+
5+
# The name of the image
6+
IMAGE=rocky8.v1
7+
8+
# The source directory or git repository
9+
# This will be mounted or cloned to /source the docker container.
10+
SOURCE=https://github.com/apache/cloudstack.git
11+
12+
# The directory where the packages will be.
13+
# This will be mounted to /output the docker container.
14+
OUTPUT=/tmp
15+
16+
# The CloudStack version, branch name or commit SHA.
17+
VERSION=main
18+
19+
# The build options.
20+
# The default value for is "-Dnoredist -DskipTests -Dsystemvm-kvm -Dsystemvm-xen -Dsystemvm-vmware"
21+
# Please refer to https://github.com/weizhouapache/docker-cloudstack-builder/blob/main/README.md
22+
BUILD_OPTS=
23+
24+
# The options for `package.sh` (RPM only)
25+
# Please refer to https://github.com/apache/cloudstack/blob/main/packaging/package.sh
26+
PACKAGE_OPTS=
27+
28+
# Please set to sudo if use a non-root user
29+
SUDO=

config.ubuntu.sample

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ SOURCE=https://github.com/apache/cloudstack.git
1414
OUTPUT=/tmp
1515

1616
# The CloudStack version, branch name or commit SHA.
17-
VERSION=4.19.0.0
17+
VERSION=main
1818

1919
# The build options.
20-
# The default value for ubuntu is "-Dnoredist -DskipTests -Dsystemvm-kvm -Dsystemvm-xen -Dsystemvm-vmware"
20+
# The default value for is "-Dnoredist -DskipTests -Dsystemvm-kvm -Dsystemvm-xen -Dsystemvm-vmware"
2121
# Please refer to https://github.com/weizhouapache/docker-cloudstack-builder/blob/main/README.md
2222
BUILD_OPTS=
2323

rocky8.v1/Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM rockylinux:8
2+
MAINTAINER Wei Zhou <weizhou@apache.org>
3+
4+
RUN yum install -y which mlocate java-11-openjdk java-11-openjdk-devel maven rpm-build \
5+
&& yum install -y gcc glibc-devel mkisofs python2 python3 python3-pip python3-setuptools wget curl \
6+
&& alternatives --set java java-11-openjdk.x86_64 \
7+
&& alternatives --set javac java-11-openjdk.x86_64 \
8+
&& alternatives --set python /usr/bin/python3
9+
10+
RUN curl -sL https://rpm.nodesource.com/setup_14.x | bash - \
11+
&& yum install -y nodejs
12+
13+
RUN yum install -y git
14+
15+
COPY entrypoint.sh /entrypoint.sh
16+
17+
ENTRYPOINT ["/entrypoint.sh"]

rocky8.v1/entrypoint.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash -x
2+
3+
# Print system information
4+
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk/
5+
mvn -version
6+
java --version
7+
javac -version
8+
9+
SOURCE_DIR=/source/
10+
OUTPUT_DIR=/output/
11+
BUILD_OPTS_DEFAULT="-Dnoredist -DskipTests -Dsystemvm-kvm -Dsystemvm-xen -Dsystemvm-vmware"
12+
13+
SOURCE=${SOURCE:-}
14+
VERSION=${VERSION:-}
15+
BUILD_OPTS=${BUILD_OPTS:-$BUILD_OPTS_DEFAULT}
16+
PACKAGE_OPTS=${PACKAGE_OPTS:-}
17+
18+
if [[ $SOURCE =~ http.* ]] || [[ $SOURCE =~ git.* ]]; then
19+
if [ -d "$SOURCE_DIR" ]; then
20+
echo "$SOURCE_DIR already exists in the container"
21+
exit 1
22+
fi
23+
git clone $SOURCE $SOURCE_DIR
24+
elif [ -z "$SOURCE_DIR" ] || [ ! -d "$SOURCE_DIR" ] || [ ! -f "$SOURCE_DIR/pom.xml" ]; then
25+
echo "Source $SOURCE_DIR does not exist in the container"
26+
exit 1
27+
fi
28+
if [ ! -d "$OUTPUT_DIR" ]; then
29+
echo "$OUTPUT_DIR does not exist in the container"
30+
exit 1
31+
fi
32+
33+
cd $SOURCE_DIR
34+
if [ ! -z "$VERSION" ]; then
35+
git checkout $VERSION
36+
fi
37+
38+
# Packaging
39+
FLAGS=$BUILD_OPTS packaging/package.sh -d centos8 $PACKAGE_OPTS
40+
41+
mv $SOURCE_DIR/dist/rpmbuild/RPMS/x86_64/cloudstack-*.rpm $OUTPUT_DIR
42+
if [[ $SOURCE =~ http.* ]] || [[ $SOURCE =~ git.* ]]; then
43+
rm -rf $SOURCE_DIR
44+
fi

ubuntu2204.v1/entrypoint.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#!/bin/bash -x
22

3+
# Print system information
4+
mvn -version
5+
java --version
6+
javac -version
7+
38
SOURCE_DIR=/source/
49
OUTPUT_DIR=/output/
510
BUILD_OPTS_DEFAULT="-Dnoredist -DskipTests -Dsystemvm-kvm -Dsystemvm-xen -Dsystemvm-vmware"
@@ -28,8 +33,10 @@ if [ ! -z "$VERSION" ]; then
2833
git checkout $VERSION
2934
fi
3035

36+
# Packaging
3137
ACS_BUILD_OPTS=$BUILD_OPTS packaging/build-deb.sh
32-
mv $SOURCE_DIR/../cloudstack*.deb $OUTPUT_DIR
38+
39+
mv $SOURCE_DIR/../cloudstack-*.deb $OUTPUT_DIR
3340
if [[ $SOURCE =~ http.* ]] || [[ $SOURCE =~ git.* ]]; then
3441
rm -rf $SOURCE_DIR
3542
fi

0 commit comments

Comments
 (0)