blob: 546b118c3ac066bac8d4cea8c2be16183469eb75 [file] [log] [blame]
# 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.
ARG TRINO_VERSION
FROM trinodb/trino:${TRINO_VERSION}
# trino base image layer has undergone changes in base os image with time.
##########################################
# Trino Versions | OS Layer #
# 359 - 369 | centos 11 #
# 370 - 389 | ubi8 #
# 390 - 391 | azul openjdk #
# 392 | ubi8 #
# 393 - 431 | eclipse-temurin #
# 432 - current | ubi9 #
##########################################
USER root
ARG TRINO_VERSION
ARG TRINO_PLUGIN_VERSION
ENV PLUGIN_DIR=ranger-${TRINO_PLUGIN_VERSION}-trino-plugin
RUN mkdir -p /home/ranger/dist
RUN mkdir -p /opt/ranger
RUN mkdir -p /home/ranger/scripts
RUN groupadd ranger
RUN useradd -g ranger -ms /bin/bash ranger
RUN usermod -a -G ranger trino
RUN chown -R ranger:ranger /home/ranger
RUN chown -R ranger:ranger /opt/ranger
COPY ./dist/version /home/ranger/dist
COPY ./dist/ranger-${TRINO_PLUGIN_VERSION}-trino-plugin.tar.gz /home/ranger/dist
COPY ./scripts/ranger-trino.sh /home/ranger/scripts
COPY ./scripts/ranger-trino-plugin-install.properties /home/ranger/scripts
RUN if [ $TRINO_VERSION -ge 370 ] && [ $TRINO_VERSION -lt 390 ] || [ $TRINO_VERSION -eq 392 ]; then\
dnf install -y initscripts;\
dnf install -y openssh-clients;\
dnf install -y openssh-server;\
elif [ $TRINO_VERSION -ge 432 ]; then\
microdnf install -y gzip;\
microdnf install -y initscripts;\
microdnf install -y openssh-clients;\
microdnf install -y openssh-server;\
else\
apt-get update; DEBIAN_FRONTEND="noninteractive" apt-get -y install ssh;\
fi
RUN tar xvfz /home/ranger/dist/${PLUGIN_DIR}.tar.gz --directory=/opt/ranger
RUN ln -s /opt/ranger/${PLUGIN_DIR} /opt/ranger/ranger-trino-plugin
RUN rm -f /home/ranger/dist/${PLUGIN_DIR}.tar.gz
RUN cp -f /home/ranger/scripts/ranger-trino-plugin-install.properties /opt/ranger/ranger-trino-plugin/install.properties
RUN chmod 744 /home/ranger/scripts/ranger-trino.sh
ENTRYPOINT ["/home/ranger/scripts/ranger-trino.sh"]