Skip to content

Commit fd36cef

Browse files
authored
RANGER-5244: Add UBI base image with CI enabled in ubi branch (#3)
1 parent 7d7ac26 commit fd36cef

4 files changed

Lines changed: 43 additions & 17 deletions

File tree

.github/workflows/build.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,18 @@ jobs:
8282
username: ${{ github.repository_owner }}
8383
password: ${{ secrets.GITHUB_TOKEN }}
8484

85+
- name: Optionally Update Java Version
86+
run: |
87+
if [ "${RANGER_BASE_JAVA_VERSION}" = "8" ]; then
88+
echo "RANGER_BASE_JAVA_VERSION=1.8.0" >> $GITHUB_ENV
89+
fi
90+
8591
- name: Build and push image to GitHub Container Registry
8692
id: build
8793
if: ${{ steps.pull.outputs.success == 'false' }}
8894
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75
8995
with:
90-
file: docker/Dockerfile
96+
context: "{{defaultContext}}:docker"
9197
build-args: RANGER_BASE_JAVA_VERSION
9298
platforms: linux/amd64,linux/arm64
9399
push: ${{ github.event_name != 'pull_request' }}

docker/Dockerfile

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,45 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
# see https://hub.docker.com/_/eclipse-temurin/tags
18-
ARG RANGER_BASE_JAVA_VERSION=8
17+
# see https://hub.docker.com/r/redhat/ubi9-minimal/tags
18+
ARG UBI_VERSION=latest
19+
FROM redhat/ubi9-minimal:${UBI_VERSION}
1920

20-
# Ubuntu 22.04 LTS
21-
FROM eclipse-temurin:${RANGER_BASE_JAVA_VERSION}-jdk-jammy
21+
ARG RANGER_BASE_JAVA_VERSION=1.8.0
22+
RUN microdnf --setopt=install_weak_deps=0 --setopt=tsflags=nodocs \
23+
install -y java-${RANGER_BASE_JAVA_VERSION}-openjdk-devel \
24+
&& microdnf clean all \
25+
&& rpm -q java-${RANGER_BASE_JAVA_VERSION}-openjdk-devel
2226

27+
ENV JAVA_HOME="/usr/lib/jvm/java-${RANGER_BASE_JAVA_VERSION}" \
28+
JAVA_VENDOR="openjdk" \
29+
JAVA_VERSION="${RANGER_BASE_JAVA_VERSION}" \
30+
JBOSS_CONTAINER_OPENJDK_JDK_MODULE="/opt/jboss/container/openjdk/jdk"
31+
32+
COPY ./requirements.txt /tmp
2333
# Install packages
24-
RUN apt update -q \
25-
&& DEBIAN_FRONTEND="noninteractive" apt install -y --no-install-recommends \
26-
bc \
27-
iputils-ping \
28-
pdsh \
34+
RUN microdnf install -y \
2935
python3 \
3036
python3-pip \
31-
python-is-python3 \
32-
ssh \
33-
tzdata \
37+
bc \
38+
iputils \
39+
hostname \
40+
tar \
41+
gzip \
42+
procps \
3443
vim \
35-
xmlstarlet \
36-
&& apt clean
44+
shadow-utils \
45+
util-linux-user \
46+
sudo \
47+
initscripts \
48+
openssh-clients \
49+
openssh-server \
50+
wget \
51+
&& ln -s /usr/bin/python3 /usr/bin/python \
52+
&& microdnf clean all
3753

3854
# Install Python modules
39-
RUN pip install apache-ranger requests \
55+
RUN pip install --no-cache-dir -r /tmp/requirements.txt apache-ranger requests \
4056
&& rm -rf ~/.cache/pip
4157

4258
# Set environment variables
@@ -45,6 +61,8 @@ ENV RANGER_SCRIPTS=/home/ranger/scripts
4561
ENV RANGER_HOME=/opt/ranger
4662
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
4763

64+
RUN sed -i 's/^HOME_MODE.*/HOME_MODE 0755/' /etc/login.defs
65+
4866
# setup groups, users, directories
4967
RUN groupadd ranger \
5068
&& for u in ranger rangeradmin rangerusersync rangertagsync rangerkms; do \

docker/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ set -u -o pipefail
2121
docker build \
2222
--build-arg RANGER_BASE_JAVA_VERSION \
2323
-t apache/ranger-base:dev \
24-
"$@" - < Dockerfile
24+
"$@" .

docker/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
apache-ranger == 0.0.12
2+
requests == 2.32.4

0 commit comments

Comments
 (0)