# syntax=docker/dockerfile:1
FROM python:3 as base
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
RUN apt-get update && apt-get install apt-transport-https
RUN apt-get install -y libjpeg62 libjpeg62-turbo-dev  zlib1g-dev gettext entr poppler-utils gettext xfonts-thai vim

RUN wget ftp://ftp.psu.ac.th/pub/thaifonts/sipa-fonts/*ttf -P /usr/share/fonts/truetype/thai
COPY fonts/*ttf  /usr/share/fonts/truetype/thai/

RUN \
        echo "Installing Node and Yarn" && \
        echo "deb https://deb.nodesource.com/node_8.x jessie main" > /etc/apt/sources.list.d/nodesource.list && \
        wget -qO- https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \
        echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list && \
        wget -qO- https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
        apt-get update && \
        apt-get install -yqq nodejs yarn npm  && \
        npm install -g nodemon mjml && \ 
        rm -rf /var/lib/apt/lists/* 

FROM base as install_package
WORKDIR /code
COPY requirements.txt /code/
RUN  pip install -r requirements.txt
COPY app /code/
#RUN chmod a+x server-entrypoint.sh
#RUN chmod a+x worker-entrypoint.sh

