FROM python:3.7

ENV DEBIAN_FRONTEND noninteractive
ENV WKHTML2PDF_VERSION 0.12.4

RUN apt-get update && \
    apt-get install -y openssl build-essential xorg libssl-dev libopenblas-dev \
    netcat \
    gettext

#### additional fonts
RUN echo "deb http://httpredir.debian.org/debian buster main contrib non-free" > /etc/apt/sources.list \
    && echo "deb http://httpredir.debian.org/debian buster-updates main contrib non-free" >> /etc/apt/sources.list \
    && echo "deb http://security.debian.org/ buster/updates main contrib non-free" >> /etc/apt/sources.list \
    && echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" | debconf-set-selections \
    && apt-get update \
    && apt-get install -y \
        fonts-arphic-ukai \
        fonts-arphic-uming \
        fonts-ipafont-mincho \
        fonts-ipafont-gothic \
        fonts-unfonts-core \
        ttf-wqy-zenhei \
    && apt-get clean \
    && apt-get autoremove -y \
    && rm -rf /var/lib/apt/lists/*

RUN wget "https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/${WKHTML2PDF_VERSION}/wkhtmltox-${WKHTML2PDF_VERSION}_linux-generic-amd64.tar.xz" \
    && tar -xJf wkhtmltox-${WKHTML2PDF_VERSION}_linux-generic-amd64.tar.xz

RUN mv wkhtmltox/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf

ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

ENV TZ=Asia/Kolkata
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

######## for oracle client installation   cx_orale 6.4.1   cx_oralce7 with django2#######
#RUN apt-get update && apt-get install zip -y && apt-get install libaio1 -y
#WORKDIR /opt/oracle
#RUN curl https://download.oracle.com/otn_software/linux/instantclient/185000/instantclient-basic-linux.x64-18.5.0.0.0dbru.zip -o instantclient-basic-linux.x64.zip
#RUN unzip instantclient-basic-linux.x64.zip
#WORKDIR /opt/oracle/instantclient_18_5
#RUN sh -c "echo /opt/oracle/instantclient_18_5 > /etc/ld.so.conf.d/oracle-instantclient.conf" \
#&& ldconfig




#RUN  mkdir /app
WORKDIR /app

COPY . /app
COPY ./zkeco_dlls/*.so /lib/
COPY ./compose/production/web/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

EXPOSE 8000


#ENV PIPENV_VENV_IN_PROJECT 1

#RUN pip3 install pipenv=='2022.8.19'
#RUN set -ex && pipenv install --system

RUN pip install -i https://pypi.org/simple -r requirements.txt

ENTRYPOINT ["/entrypoint.sh"]
