blob: c8854ba1ac47b79d391b954a55f11d8e2ed44ac7 [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 RANGER_BASE_IMAGE
ARG RANGER_BASE_VERSION
FROM ${RANGER_BASE_IMAGE}:${RANGER_BASE_VERSION}
ARG USERSYNC_VERSION
VOLUME /etc/keytabs
COPY ./dist/version /home/ranger/dist/
COPY ./dist/ranger-${USERSYNC_VERSION}-usersync.tar.gz /home/ranger/dist/
COPY ./scripts/usersync/ranger-usersync.sh ${RANGER_SCRIPTS}/
COPY ./scripts/usersync/ranger-usersync-install.properties ${RANGER_SCRIPTS}/
COPY ./scripts/usersync/ugsync-file-source.csv ${RANGER_SCRIPTS}/
COPY ./scripts/hadoop/core-site.xml ${RANGER_SCRIPTS}/
COPY ./scripts/wait_for_keytab.sh ${RANGER_SCRIPTS}/
COPY ./scripts/kdc/krb5.conf /etc/krb5.conf
RUN tar xvfz /home/ranger/dist/ranger-${USERSYNC_VERSION}-usersync.tar.gz --directory=${RANGER_HOME} && \
ln -s ${RANGER_HOME}/ranger-${USERSYNC_VERSION}-usersync ${RANGER_HOME}/usersync && \
rm -f /home/ranger/dist/ranger-${USERSYNC_VERSION}-usersync.tar.gz && \
cp -f ${RANGER_SCRIPTS}/ranger-usersync-install.properties ${RANGER_HOME}/usersync/install.properties && \
mkdir -p /var/run/ranger /var/log/ranger/usersync && \
mkdir -p /etc/ranger && \
mkdir -p /etc/init.d /etc/rc2.d /etc/rc3.d && \
touch /etc/init.d/ranger-usersync && \
ln -s /etc/init.d/ranger-usersync /etc/rc2.d/S99ranger-usersync && \
ln -s /etc/init.d/ranger-usersync /etc/rc2.d/K00ranger-usersync && \
ln -s /etc/init.d/ranger-usersync /etc/rc3.d/S99ranger-usersync && \
ln -s /etc/init.d/ranger-usersync /etc/rc3.d/K00ranger-usersync && \
ln -s ${RANGER_HOME}/usersync/ranger-usersync-services.sh /usr/bin/ranger-usersync && \
chown -R ranger:ranger ${RANGER_HOME}/usersync/ ${RANGER_SCRIPTS}/ /var/run/ranger/ /var/log/ranger/ /etc/ranger /etc/init.d/ranger-usersync && \
chmod 755 ${RANGER_SCRIPTS}/wait_for_keytab.sh && \
chmod 744 ${RANGER_SCRIPTS}/ranger-usersync.sh
USER ranger
ENTRYPOINT [ "/home/ranger/scripts/ranger-usersync.sh" ]