Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CentOS8 image #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 13 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,36 +85,19 @@ jobs:
if: contains(github.ref, 'refs/heads/master') && env.REGISTRY_USERNAME != ''
run: DOCKER_TAG=centos7-jdk11 make push

latest:
centos8:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Build latest
run: make latest

- name: Login to Docker
uses: docker/login-action@v1
if: contains(github.ref, 'refs/heads/master') && env.REGISTRY_USERNAME != ''
with:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Push latest
if: contains(github.ref, 'refs/heads/master') && env.REGISTRY_USERNAME != ''
run: DOCKER_TAG=latest make push

latest-jdk8:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build centos8
run: make centos8

- name: Build latest-jdk8
run: make latest-jdk8
- name: Test centos8
if: "!contains(github.ref, 'refs/heads/master')"
run: ./scripts/test.sh centos8 refs/heads/4.15 "--distribution centos8"

- name: Login to Docker
uses: docker/login-action@v1
Expand All @@ -123,19 +106,19 @@ jobs:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Push latest-jdk8
- name: Push centos8
if: contains(github.ref, 'refs/heads/master') && env.REGISTRY_USERNAME != ''
run: DOCKER_TAG=latest-jdk8 make push
run: DOCKER_TAG=centos8 make push

latest-jdk11:
latest:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Build latest-jdk11
run: make latest-jdk11
- name: Build latest
run: make latest

- name: Login to Docker
uses: docker/login-action@v1
Expand All @@ -144,6 +127,6 @@ jobs:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Push latest-jdk11
- name: Push latest
if: contains(github.ref, 'refs/heads/master') && env.REGISTRY_USERNAME != ''
run: DOCKER_TAG=latest-jdk11 make push
run: DOCKER_TAG=latest make push
19 changes: 7 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ define build_tag
endef

.PHONY: all
all: centos6 centos7 centos7-jdk8 centos7-jdk11 latest latest-jdk8 latest-jdk11
all: centos6 centos7 centos7-jdk8 centos7-jdk11 centos8 latest

.PHONY: centos6
centos6: ## Build centos6 image
Expand All @@ -54,20 +54,15 @@ centos7-jdk11: ## Build centos7-jdk11 image
@ $(MAKE) --no-print-directory log-$@
$(call build_tag,centos7-jdk11,centos7,Dockerfile.jdk11)

.PHONY: latest
latest: ## Build latest image
@ $(MAKE) --no-print-directory log-$@
$(call build_tag,latest,centos7,Dockerfile.jdk8)

.PHONY: latest-jdk8
latest-jdk8: ## Build latest-jdk8 image
.PHONY: centos8
centos8: ## Build centos8 image
@ $(MAKE) --no-print-directory log-$@
$(call build_tag,latest-jdk8,centos7,Dockerfile.jdk8)
$(call build_tag,centos8,centos8,Dockerfile)

.PHONY: latest-jdk11
latest-jdk11: ## Build latest-jdk11 image
.PHONY: latest
latest: ## Build latest image
@ $(MAKE) --no-print-directory log-$@
$(call build_tag,latest-jdk11,centos7,Dockerfile.jdk11)
$(call build_tag,latest,centos8,Dockerfile)

.PHONY: push
push: DOCKER_TAG ?=
Expand Down
28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ project.

## Supported tags and respective `Dockerfile` links

- [`latest`, `latest-jdk8`, `centos7`, `centos7-jdk8`(centos7/Dockerfile.jdk8)][centos7-dockerfile]
- [`latest-jdk11`, `centos7-jdk11` (centos7/Dockerfile.jdk11)][latest-jdk11-dockerfile]
- [`latest`, `centos8` (centos8/Dockerfile)][centos8-dockerfile]
- [`centos7`, `centos7-jdk8`(centos7/Dockerfile.jdk8)][centos7-jdk8-dockerfile]
- [`centos7-jdk11` (centos7/Dockerfile.jdk11)][centos7-jdk11-dockerfile]
- [`centos6` (centos6/Dockerfile)][centos6-dockerfile] [EOL - not supported anymore]

## Packages installed in container
Expand Down Expand Up @@ -62,10 +63,10 @@ Let's assume we want to build packages for CentOS 7 on CentOS 7. We pull that
image first:

```bash
docker pull khos2ow/cloudstack-rpm-builder:centos7-jdk11
docker pull khos2ow/cloudstack-rpm-builder:centos8
```

You can replace `centos7-jdk11` tag by [one of the other tags].
You can replace `centos8` tag by [one of the other tags].

### Build local repository

Expand All @@ -92,7 +93,7 @@ always expects the `cloudstack` code exists in `/mnt/build` path.)
```bash
docker run \
-v /tmp:/mnt/build \
khos2ow/cloudstack-rpm-builder:centos7-jdk11 --distribution centos7 [ARGS...]
khos2ow/cloudstack-rpm-builder:centos8 --distribution centos7 [ARGS...]
```

Or if your local cloudstack folder has other name, you need to map it to
Expand All @@ -101,7 +102,7 @@ Or if your local cloudstack folder has other name, you need to map it to
```bash
docker run \
-v /tmp/cloudstack-custom-name:/mnt/build/cloudstack \
khos2ow/cloudstack-rpm-builder:centos7-jdk11 --distribution centos7 [ARGS...]
khos2ow/cloudstack-rpm-builder:centos8 --distribution centos7 [ARGS...]
```

After the build has finished the `.rpm` packages are available in
Expand All @@ -125,10 +126,10 @@ flag) in `/mnt/build/cloudstack` inside the container and can be accessed from
```bash
docker run \
-v /tmp:/mnt/build \
khos2ow/cloudstack-rpm-builder:centos7-jdk11 \
khos2ow/cloudstack-rpm-builder:centos8 \
--git-remote https://github.com/apache/cloudstack.git \
--git-ref master \
--distribution centos7 [ARGS...]
--distribution centos8 [ARGS...]
```

Note that any valid git Refspec is acceptable, such as:
Expand All @@ -155,7 +156,7 @@ it run faster.
docker run \
-v /tmp:/mnt/build \
-v ~/.m2:/root/.m2 \
khos2ow/cloudstack-rpm-builder:centos7-jdk11 --distribution centos7 [ARGS...]
khos2ow/cloudstack-rpm-builder:centos8 --distribution centos7 [ARGS...]
```

### Adjust host owner permission
Expand All @@ -175,7 +176,7 @@ docker run \
-v /tmp:/mnt/build \
-e "USER_ID=$(id -u)" \
-e "USER_GID=$(id -g)" \
khos2ow/cloudstack-rpm-builder:centos7-jdk11 --distribution centos7 [ARGS...]
khos2ow/cloudstack-rpm-builder:centos8 --distribution centos7 [ARGS...]
```

## Builder help
Expand All @@ -185,16 +186,17 @@ To see all the available options you can pass to `docker run ...` command:
```bash
docker run \
-v /tmp:/mnt/build \
khos2ow/cloudstack-rpm-builder:centos7-jdk11 --help
khos2ow/cloudstack-rpm-builder:centos8 --help
```

## License

Licensed under [Apache License version 2.0]. Please see the [LICENSE] file
included in the root directory of the source tree for extended license details.

[centos7-dockerfile]: https://github.com/khos2ow/cloudstack-rpm-builder/blob/master/centos7/Dockerfile.jdk8
[latest-jdk11-dockerfile]: https://github.com/khos2ow/cloudstack-rpm-builder/blob/master/centos7/Dockerfile.jdk11
[centos8-dockerfile]: https://github.com/khos2ow/cloudstack-rpm-builder/blob/master/centos8/Dockerfile
[centos7-jdk8-dockerfile]: https://github.com/khos2ow/cloudstack-rpm-builder/blob/master/centos7/Dockerfile.jdk8
[centos7-jdk11-dockerfile]: https://github.com/khos2ow/cloudstack-rpm-builder/blob/master/centos7/Dockerfile.jdk11
[centos6-dockerfile]: https://github.com/khos2ow/cloudstack-rpm-builder/blob/master/centos6/Dockerfile
[one of the other tags]: #supported-tags-and-respective-dockerfile-links
[https://github.com/apache/cloudstack]: https://github.com/apache/cloudstack
Expand Down
63 changes: 63 additions & 0 deletions centos8/Dockerfile
Original file line number Diff line number Diff line change
@@ -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:8
LABEL maintainer="Khosrow Moossavi <me@khosrow.io> (@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"]
Loading