FROM python:3.11.4

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 \
    ncat \
    gettext

#### additional fonts
RUN echo "deb http://archive.debian.org/debian/ stretch main contrib non-free" > /etc/apt/sources.list \
    && echo "deb http://archive.debian.org/debian-security/ stretch/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


########for sqlserver  on Ubuntu22 odbc driver 18 
#RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -

#RUN curl https://packages.microsoft.com/config/ubuntu/22.04/prod.list > /etc/apt/sources.list.d/mssql-release.list


#RUN apt-get update && ACCEPT_EULA=Y apt-get install -y msodbcsql18





#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
#--ignore-pipfile
#RUN set -ex && pipenv install --system --ignore-pipfile
RUN pip install -i https://pypi.org/simple -r requirements.txt
ENTRYPOINT ["/entrypoint.sh"]