# Dockerfile

FROM       centos:centos7

WORKDIR    /var/app

# Update and install common packages
RUN        yum -y update
RUN        yum -y install curl git tar zip which

# Add IUS repositories
RUN        yum -y install https://centos7.iuscommunity.org/ius-release.rpm

# Install Python 3.6 and wsgi dependencies
RUN        yum -y install gcc python36 python36-libs python36-devel python36-pip

# Install dependencies
RUN        yum -y install make glibc-static openssl openssl-devel

# Install pipenv
RUN        ln -s /usr/bin/pip3.6 /usr/bin/pip
RUN        /usr/bin/pip install pipenv

# Explicitly set locale and related env vars to use en_US.UTF-8
RUN        localedef -c -f UTF-8 -i en_US en_US.UTF-8
ENV        LC_ALL=en_US.UTF-8
ENV        LANG=en_US.UTF-8

# Add application and install requirements
ADD        . /var/app
RUN        if [ -f /var/app/Pipfile.lock ]; then pipenv install --ignore-pipfile --system; fi
RUN        /usr/bin/pip install .

# Install supervisord
RUN yum -y install supervisor

# Prevent irrelevant warnings from cluttering Kibana
ENV PYTHONWARNINGS="ignore::UserWarning:cffi.cparser.py"

# Run supervisord
ENTRYPOINT ["/usr/bin/supervisord", "-c", "conf/supervisor.conf"]

EXPOSE 9001

