Skip to content
Merged
8 changes: 7 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,18 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Optionally Update Java Version
run: |
if [ "${RANGER_BASE_JAVA_VERSION}" = "8" ]; then
echo "RANGER_BASE_JAVA_VERSION=1.8.0" >> $GITHUB_ENV
fi

- name: Build and push image to GitHub Container Registry
id: build
if: ${{ steps.pull.outputs.success == 'false' }}
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75
with:
file: docker/Dockerfile
context: "{{defaultContext}}:docker"
build-args: RANGER_BASE_JAVA_VERSION
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
Expand Down
48 changes: 33 additions & 15 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,45 @@
# See the License for the specific language governing permissions and
# limitations under the License.

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

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

ENV JAVA_HOME="/usr/lib/jvm/java-${RANGER_BASE_JAVA_VERSION}" \
JAVA_VENDOR="openjdk" \
JAVA_VERSION="${RANGER_BASE_JAVA_VERSION}" \
JBOSS_CONTAINER_OPENJDK_JDK_MODULE="/opt/jboss/container/openjdk/jdk"

COPY ./requirements.txt /tmp
# Install packages
RUN apt update -q \
&& DEBIAN_FRONTEND="noninteractive" apt install -y --no-install-recommends \
bc \
iputils-ping \
pdsh \
RUN microdnf install -y \
python3 \
python3-pip \
python-is-python3 \
ssh \
tzdata \
bc \
iputils \
hostname \
tar \
gzip \
procps \
vim \
xmlstarlet \
&& apt clean
shadow-utils \
util-linux-user \
sudo \
initscripts \
openssh-clients \
openssh-server \
wget \
&& ln -s /usr/bin/python3 /usr/bin/python \
&& microdnf clean all

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

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

RUN sed -i 's/^HOME_MODE.*/HOME_MODE 0755/' /etc/login.defs

# setup groups, users, directories
RUN groupadd ranger \
&& for u in ranger rangeradmin rangerusersync rangertagsync rangerkms; do \
Expand Down
2 changes: 1 addition & 1 deletion docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ set -u -o pipefail
docker build \
--build-arg RANGER_BASE_JAVA_VERSION \
-t apache/ranger-base:dev \
"$@" - < Dockerfile
"$@" .
2 changes: 2 additions & 0 deletions docker/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
apache-ranger == 0.0.12
requests == 2.32.4