|
2 | 2 |
|
3 | 3 | This repository maintains the Dockerfile and scripts to build Apache CloudStack in docker images. |
4 | 4 |
|
5 | | -## Ubuntu 22.04 (for Ubuntu distributions) |
| 5 | +## Compatibility matrix |
6 | 6 |
|
7 | | -## Rocky Linux 8 (for Rocky Linux 8/9, AlmaLinux 8/9, Orache Linux 8/9, RHEL 8/9) |
| 7 | +| **Dockerfile** | **CloudStack versions** | **Note** | |
| 8 | +|---------------------|-------------------------------|----------------------| |
| 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 | |
8 | 11 |
|
9 | | -## CentOS 7 |
| 12 | +## Usage |
10 | 13 |
|
| 14 | +### (Optional) Build docker image |
| 15 | + |
| 16 | +The pre-built image can be found at https://hub.docker.com/repository/docker/weizhouapache/cloudstack-builder |
| 17 | + |
| 18 | +``` |
| 19 | +cd ubuntu2204.v1 |
| 20 | +docker build -f Dockerfile -t weizhouapache/cloudstack-builder:ubuntu2204.v1 . |
| 21 | +``` |
| 22 | + |
| 23 | +### 1. Build packages with configuration file |
| 24 | + |
| 25 | +``` |
| 26 | +./build.sh -c <configuration file name> |
| 27 | +``` |
| 28 | + |
| 29 | +Below are configurations in the configuration file. |
| 30 | + |
| 31 | +| **Variablies** | **Description** | **Note** | |
| 32 | +|---------------------|-------------------------------|----------------------| |
| 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. | |
| 38 | + |
| 39 | +A sample of environment variables can be found at `config.ubuntu.sample`. |
| 40 | + |
| 41 | +### 2. Build packages with parameters |
| 42 | + |
| 43 | +``` |
| 44 | +Usage: ./build.sh |
| 45 | + -r <the repository of the image. Default is weizhouapache/cloudstack-builder> |
| 46 | + -i <the name of the image> |
| 47 | + -s <the source directory or git repository> |
| 48 | + -o <the output directory> |
| 49 | + -v <the CloudStack version, branch name or commit SHA> |
| 50 | + -b <the build options> |
| 51 | + -u # use sudo |
| 52 | + -c <the name of config file which includes all settings above> |
| 53 | + -d # dry-run |
| 54 | + -h # help message |
| 55 | +``` |
| 56 | + |
| 57 | +Examples |
| 58 | +``` |
| 59 | +# Build from a local directory |
| 60 | +./build.sh -i ubuntu2204.v1 -s /data/cloudstack -o /tmp -b "-Dnoredist -DskipTests -Dsystemvm-kvm -Dsystemvm-xen -Dsystemvm-vmware" |
| 61 | +
|
| 62 | +# Build from git repository |
| 63 | +./build.sh -i ubuntu2204.v1 -s https://github.com/apache/cloudstack.git -o /tmp -v main -b "-Dnoredist -DskipTests -Dsystemvm-kvm -Dsystemvm-xen -Dsystemvm-vmware" -u |
| 64 | +``` |
| 65 | + |
| 66 | +### 3. Build packages by `docker` command |
| 67 | + |
| 68 | +An example how to build packages from local directory |
| 69 | +``` |
| 70 | +SUDO= |
| 71 | +SOURCE=./ |
| 72 | +OUTPUT=/tmp/ |
| 73 | +CONTAINER_NAME="cloudstack-builder-$(echo $RANDOM | tr '[0-9]' '[a-z]')" |
| 74 | +
|
| 75 | +$SUDO mkdir -p ~/.m2/ |
| 76 | +$SUDO mkdir -p ${OUTPUT} |
| 77 | +$SUDO docker run -ti \ |
| 78 | + -n $CONTAINER_NAME \ |
| 79 | + -v ~/.m2:/root/.m2/ \ |
| 80 | + -v ${SOURCE}:/source/ \ |
| 81 | + -v ${OUTPUT}:/output/ \ |
| 82 | + --env BUILD_OPTS="-Dnoredist -DskipTests -Dsystemvm-kvm -Dsystemvm-xen -Dsystemvm-vmware" \ |
| 83 | + weizhouapache/cloudstack-builder:ubuntu2204.v1 |
| 84 | +``` |
| 85 | + |
| 86 | +An example how to build packages from git repository |
| 87 | + |
| 88 | +``` |
| 89 | +SUDO= |
| 90 | +SOURCE=https://github.com/apache/cloudstack.git |
| 91 | +VERSION=4.19.0.0 |
| 92 | +OUTPUT=/tmp/ |
| 93 | +BUILD_OPTS="-Dnoredist -DskipTests -Dsystemvm-kvm -Dsystemvm-xen -Dsystemvm-vmware" |
| 94 | +CONTAINER_NAME="cloudstack-builder-$(echo $RANDOM | tr '[0-9]' '[a-z]')" |
| 95 | +
|
| 96 | +$SUDO mkdir -p ~/.m2/ |
| 97 | +$SUDO mkdir -p ${OUTPUT} |
| 98 | +$SUDO docker run -ti \ |
| 99 | + -n $CONTAINER_NAME \ |
| 100 | + -v ~/.m2:/root/.m2/ \ |
| 101 | + -v ${OUTPUT}:/output/ \ |
| 102 | + -e SOURCE \ |
| 103 | + -e OUTPUT \ |
| 104 | + -e BUILD_OPTS \ |
| 105 | + weizhouapache/cloudstack-builder:ubuntu2204.v1 |
| 106 | +``` |
| 107 | +## Build Options |
| 108 | + |
| 109 | +| **OS** | **Option** | **Note** | |
| 110 | +|-------------|--------------------|----------------------| |
| 111 | +| Ubuntu | -Dnoredist | Support non-Open Source Software (e.g. VMware) | |
| 112 | +| | -DskipTests | Skip unit tests | |
| 113 | +| | -Dsystemvm-kvm | Bundle with SystemVM template for KVM | |
| 114 | +| | -Dsystemvm-vmware | Bundle with SystemVM template for VMware | |
| 115 | +| | -Dsystemvm-xen | Bundle with SystemVM template for XenServer/XCP-ng | |
| 116 | + |
| 117 | + |
| 118 | +The default value for ubuntu images is `-Dnoredist -DskipTests -Dsystemvm-kvm -Dsystemvm-xen -Dsystemvm-vmware` |
0 commit comments