# 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.
RUN chmod -R 777 /tmp
RUN mkdir -p /kunlun
RUN rm -f /bin/sh && ln -s /bin/bash /bin/sh
COPY . /kunlun/
WORKDIR /kunlun

ENV DEBIAN_FRANTEND=noninteractive
ARG KUNLUN_VERSION
RUN cp -f sources.list /etc/apt
RUN apt-get update > /dev/null && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y apt-utils apache2  apache2-utils php php-pgsql php-mysql sudo \
    php-curl php-zip php-xml php-mbstring libapache2-mod-php vim unzip python2 cron curl > /dev/null

RUN echo "export KUNLUN_VERSION=$KUNLUN_VERSION" > /kunlun/VERSION
RUN /bin/bash -x /kunlun/build.sh

# postgresql ports.
EXPOSE 80
EXPOSE 3000
