# syntax=docker/dockerfile:1

#FROM debian:bullseye
FROM balenalib/raspberry-pi-debian:latest
RUN apt-get update 
#RUN apt-get install wget git gcc python3-pip tesseract-ocr build-essential cmake pkg-config libjpeg-dev libtiff5-dev libpng-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev libfontconfig1-dev libcairo2-dev libgdk-pixbuf2.0-dev libpango1.0-dev libgtk2.0-dev libgtk-3-dev libatlas-base-dev gfortran libhdf5-dev libhdf5-serial-dev libhdf5-103 python3-pyqt5 python3-dev libssl-dev  -y
RUN apt-get install tesseract-ocr
RUN apt-get install git -y
RUN apt-get install wget -y
RUN apt-get install python3-pip -y
RUN apt-get install patch -y
RUN apt-get install cmake -y 
#RUN apt-get install libraspberrypi-bin -y
WORKDIR /tmp
RUN git clone https://github.com/adrianlazaro8/Tesseract_sevenSegmentsLetsGoDigital && cd Tesseract_sevenSegmentsLetsGoDigital && mv 'Trained data'/* /usr/share/tesseract-ocr/4.00/tessdata/
WORKDIR /app
RUN mkdir images
RUN wget https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh
RUN chmod +x wait-for-it.sh
COPY src/requirements.txt . 
RUN pip3 install --upgrade pip
RUN export READTHEDOCS=True && pip3 install -r requirements.txt --default-timeout=100
COPY src/ .
RUN chmod +x entrypoint.sh
CMD [ "./entrypoint.sh"]
