# Copyright (c) 2019 ZettaDB inc. All rights reserved.
# This source code is licensed under Apache 2.0 License,
# combined with Common Clause Condition 1.0, as detailed in the NOTICE file.

FROM ubuntu:20.04

# Install necessary utilities.
# vim, iputils-ping, net-tools, dnsutils are used for easy debugging, they can be removed for formal release.
RUN chmod -R 777 /tmp
RUN rm -f /bin/sh && ln -s /bin/bash /bin/sh
RUN apt-get update >/dev/null && apt-get install -y libssl-dev sudo \
    python2 >/dev/null
# The following can be added when testing.
# vim iputils-ping net-tools dnsutils 

RUN mkdir -p /kunlun
WORKDIR /kunlun
ENV LANG=en_US.UTF-8
ARG KUNLUN_VERSION

# copy files.
COPY . /kunlun/
RUN echo "export LANG=en_US.UTF-8" >> /etc/profile
RUN echo "export KUNLUN_VERSION=$KUNLUN_VERSION" > /kunlun/VERSION
RUN chmod -R 777 /kunlun/VERSION

RUN /bin/bash -x /kunlun/install_cluster_manager.sh
