diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 48f41e8..630bff2 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -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' }} diff --git a/docker/Dockerfile b/docker/Dockerfile index 6ba1a83..4937b30 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -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 @@ -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 \ diff --git a/docker/build.sh b/docker/build.sh index 51890e8..53e13ed 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -21,4 +21,4 @@ set -u -o pipefail docker build \ --build-arg RANGER_BASE_JAVA_VERSION \ -t apache/ranger-base:dev \ - "$@" - < Dockerfile + "$@" . diff --git a/docker/requirements.txt b/docker/requirements.txt new file mode 100644 index 0000000..863807b --- /dev/null +++ b/docker/requirements.txt @@ -0,0 +1,2 @@ +apache-ranger == 0.0.12 +requests == 2.32.4 \ No newline at end of file