diff --git a/.circleci/config.yml b/.circleci/config.yml index 82afc63..8ed36c5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -87,6 +87,15 @@ workflows: branches: ignore: master + - test: + name: test-centos7-jdk11 + tag: centos7 + ref: refs/heads/4.14 + param: --distribution centos7 + filters: + branches: + ignore: master + build: jobs: - push: @@ -96,6 +105,36 @@ workflows: branches: only: master + - push: + name: push-centos7-jdk11 + tag: centos7-jdk11 + filters: + branches: + only: master + ignore: /.*/ + + - push: + name: push-latest-jdk11 + tag: latest-jdk11 + filters: + branches: + only: master + + - push: + name: push-centos7-jdk8 + tag: centos7-jdk8 + filters: + branches: + only: master + ignore: /.*/ + + - push: + name: push-latest-jdk8 + tag: latest-jdk8 + filters: + branches: + only: master + - push: name: push-centos7 tag: centos7 diff --git a/Makefile b/Makefile index beff608..79a26c1 100644 --- a/Makefile +++ b/Makefile @@ -19,22 +19,42 @@ DOCKER_IMAGE ?= khos2ow/cloudstack-rpm-builder DOCKER_TAG ?= .PHONY: all -all: centos6 centos7 latest +all: centos6 centos7-jdk11 latest-jdk11 centos7-jdk8 latest-jdk8 centos7 latest .PHONY: centos6 centos6: DOCKER_TAG := centos6 centos6: docker build --pull --tag $(DOCKER_IMAGE):$(DOCKER_TAG) --file centos6/Dockerfile centos6/ +.PHONY: centos7-jdk11 +centos7-jdk11: DOCKER_TAG := centos7-jdk11 +centos7-jdk11: + docker build --pull --tag $(DOCKER_IMAGE):$(DOCKER_TAG) --file centos7/Dockerfile.jdk11 centos7/ + +.PHONY: latest-jdk11 +latest-jdk11: DOCKER_TAG := latest-jdk11 +latest-jdk11: + docker build --pull --tag $(DOCKER_IMAGE):$(DOCKER_TAG) --file centos7/Dockerfile.jdk11 centos7/ + +.PHONY: centos7-jdk8 +centos7-jdk8: DOCKER_TAG := centos7-jdk8 +centos7-jdk8: + docker build --pull --tag $(DOCKER_IMAGE):$(DOCKER_TAG) --file centos7/Dockerfile.jdk8 centos7/ + +.PHONY: latest-jdk8 +latest-jdk8: DOCKER_TAG := latest-jdk8 +latest-jdk8: + docker build --pull --tag $(DOCKER_IMAGE):$(DOCKER_TAG) --file centos7/Dockerfile.jdk8 centos7/ + .PHONY: centos7 centos7: DOCKER_TAG := centos7 centos7: - docker build --pull --tag $(DOCKER_IMAGE):$(DOCKER_TAG) --file centos7/Dockerfile centos7/ + docker build --pull --tag $(DOCKER_IMAGE):$(DOCKER_TAG) --file centos7/Dockerfile.jdk8 centos7/ .PHONY: latest latest: DOCKER_TAG := latest latest: - docker build --pull --tag $(DOCKER_IMAGE):$(DOCKER_TAG) --file centos7/Dockerfile centos7/ + docker build --pull --tag $(DOCKER_IMAGE):$(DOCKER_TAG) --file centos7/Dockerfile.jdk8 centos7/ .PHONY: push push: diff --git a/README.md b/README.md index 05bf601..fd6d495 100644 --- a/README.md +++ b/README.md @@ -28,10 +28,11 @@ This will give portable, immutable and reproducable mechanism to build packages ## Supported tags and respective `Dockerfile` links -- [`latest`, `centos7` (centos7/Dockerfile)](https://github.com/khos2ow/cloudstack-rpm-builder/blob/master/centos7/Dockerfile) +- [`latest`, `latest-jdk8`, `centos7`, `centos7-jdk8` (centos7/Dockerfile.jdk8)](https://github.com/khos2ow/cloudstack-rpm-builder/blob/master/centos7/Dockerfile.jdk8) +- [`latest-jdk11`, `centos7-jdk11` (centos7/Dockerfile.jdk11)](https://github.com/khos2ow/cloudstack-rpm-builder/blob/master/centos7/Dockerfile.jdk11) - [`centos6` (centos6/Dockerfile)](https://github.com/khos2ow/cloudstack-rpm-builder/blob/master/centos6/Dockerfile) -## Packges installed in conatiner +## Packges installed in container List of available packages inside the container: @@ -40,7 +41,7 @@ List of available packages inside the container: - createrepo - mkisofs - git -- java 1.8 +- java (JDK 8 or JDK 11) - maven 3.5 - tomcat - python @@ -56,9 +57,9 @@ Building RPM packages with the Docker container is rather easy, a few steps are Let's assume we want to build packages for CentOS 7 on CentOS 7. We pull that image first: - docker pull khos2ow/cloudstack-rpm-builder:centos7 + docker pull khos2ow/cloudstack-rpm-builder:centos7-jdk11 -You can replace `centos7` tag by `centos6` or `latest` if you want. +You can replace `centos7-jdk11` tag by [one of the other tags](#supported-tags-and-respective-dockerfile-links). ### Build local repository @@ -78,13 +79,13 @@ Now that we have cloned the CloudStack source code locally, we can build package docker run \ -v /tmp:/mnt/build \ - khos2ow/cloudstack-rpm-builder:centos7 --distribution centos7 [ARGS...] + khos2ow/cloudstack-rpm-builder:centos7-jdk11 --distribution centos7 [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-rpm-builder:centos7 --distribution centos7 [ARGS...] + khos2ow/cloudstack-rpm-builder:centos7-jdk11 --distribution centos7 [ARGS...] After the build has finished the *.rpm* packages are available in */tmp/cloudstack/dist/rpmbuild/RPMS* on the host system. @@ -98,7 +99,7 @@ Now let's assume we want to build packages of `HEAD` of `master` branch from htt docker run \ -v /tmp:/mnt/build \ - khos2ow/cloudstack-rpm-builder:centos7 \ + khos2ow/cloudstack-rpm-builder:centos7-jdk11 \ --git-remote https://github.com/apache/cloudstack.git \ --git-ref master \ --distribution centos7 [ARGS...] @@ -124,7 +125,7 @@ You can provide Maven cache folder (`~/.m2`) as a volume to the container to mak docker run \ -v /tmp:/mnt/build \ -v ~/.m2:/root/.m2 \ - khos2ow/cloudstack-rpm-builder:centos7 --distribution centos7 [ARGS...] + khos2ow/cloudstack-rpm-builder:centos7-jdk11 --distribution centos7 [ARGS...] ### Adjust host owner permission @@ -136,7 +137,7 @@ This is specially useful if you want to use this image in Jenkins job and want t -v /tmp:/mnt/build \ -e "USER_ID=$(id -u)" \ -e "USER_GID=$(id -g)" \ - khos2ow/cloudstack-rpm-builder:centos7 --distribution centos7 [ARGS...] + khos2ow/cloudstack-rpm-builder:centos7-jdk11 --distribution centos7 [ARGS...] ## Builder help @@ -144,8 +145,8 @@ To see all the available options you can pass to `docker run ...` command: docker run \ -v /tmp:/mnt/build \ - khos2ow/cloudstack-rpm-builder:centos7 --help + khos2ow/cloudstack-rpm-builder:centos7-jdk11 --help ## License -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. \ No newline at end of file +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. diff --git a/centos7/Dockerfile.jdk11 b/centos7/Dockerfile.jdk11 new file mode 100644 index 0000000..a5b5da0 --- /dev/null +++ b/centos7/Dockerfile.jdk11 @@ -0,0 +1,63 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +FROM centos:7 +LABEL maintainer="Khosrow Moossavi (@khos2ow)" + +RUN \ + yum clean metadata && \ + yum install -y epel-release && \ + yum clean metadata && \ + yum install -y \ + make \ + which \ + mlocate \ + tar \ + rpm-build \ + yum-utils \ + createrepo \ + mkisofs \ + git \ + java-11-openjdk-devel \ + tomcat \ + python python3 python-dev py-pip \ + python-argparse python-yaml python-pip python-wheel \ + mysql-connector-python \ + gcc \ + gcc-c++ \ + jq \ + wget \ + ws-commons-util && \ + yum upgrade python-setuptools && \ + pip install --upgrade pip && \ + wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo && \ + yum clean metadata && \ + yum install -y \ + apache-maven && \ + yum clean all && rm -rf /var/cache/yum && \ + sed -i "s/%dist .el7$/%dist .el7.centos/g" /etc/rpm/macros.dist + +ENV JAVA_HOME=/usr/lib/jvm/java-11 +RUN alternatives --set java $(readlink -f ${JAVA_HOME}/bin/java) + +VOLUME /mnt/build +WORKDIR /mnt/build + +COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh +COPY environment-info.sh /usr/local/bin/environment-info.sh + +ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/centos7/Dockerfile b/centos7/Dockerfile.jdk8 similarity index 100% rename from centos7/Dockerfile rename to centos7/Dockerfile.jdk8