FROM python:3.8

RUN python -m venv /app/venv
ENV PATH="/app/venv/bin:$PATH"

RUN python -m pip install --upgrade pip

WORKDIR /app/service

COPY ./requirements.txt ./requirements.txt
RUN python3 -m pip install -r requirements.txt

COPY ./incl/pdf2image/requirements.txt ./incl/pdf2image/requirements.txt
RUN python -m pip install -r incl/pdf2image/requirements.txt

COPY ./incl ./incl

RUN python3 -m pip install incl/pyinfra
RUN python3 -m pip install -e incl/pdf2image

COPY ./src ./src
COPY ./cv_analysis ./cv_analysis
COPY ./setup.py ./setup.py

RUN python3 -m pip install -e .

CMD ["python3", "-u", "src/serve.py"]