#
# 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.
#

# Docker image for apache kylin, based on the Hadoop image
# FROM hadoop3.2.1-all-in-one-for-kylin5
FROM apachekylin/apache-kylin-standalone:5.x-base-dev-only

USER root

RUN apt-get -y install curl
RUN apt-get update && apt-get -y install openjdk-8-jdk unzip iputils-ping net-tools

# make a new workdir
RUN mkdir -p /home/kylin
RUN mkdir -p /home/kylin/data
RUN mkdir -p /home/kylin/scripts

WORKDIR /home/kylin

ENV HADOOP_CONF_DIR /opt/hadoop-3.2.1/etc/hadoop

COPY conf/hadoop-dev/* $HADOOP_CONF/
COPY dev-docker/*.sql /home/kylin/scripts/
COPY conf/mysql/my.cnf /etc/mysql/conf.d/
COPY package/tpch-sf2.zip /home/kylin/scripts/

COPY dev-docker/entrypoint-dev.sh /home/kylin/entrypoint-dev.sh
RUN chmod u+x /home/kylin/entrypoint-dev.sh

ENTRYPOINT ["/home/kylin/entrypoint-dev.sh"]