FROM python:3.10-slim

# Copy local code to the container image.
ENV APP_HOME /app
WORKDIR $APP_HOME

RUN apt update && apt install -y \
    libgl1-mesa-glx \
    libglib2.0-dev \
    git

RUN git clone https://github.com/LiteraturePro/MODNet.git && cp -r MODNet/* ./ && ls

RUN pip install --upgrade pip && pip install -r requirements.txt

# CPU
RUN pip install torch==1.13.0+cpu torchvision==0.14.0+cpu torchaudio==0.13.0 --extra-index-url https://download.pytorch.org/whl/cpu


# CMD exec gunicorn --bind 0.0.0.0:7860 --workers 1 --threads 8 --timeout 0 app:app
# CMD exec gunicorn --bind 0.0.0.0:$PORT --workers 1 --threads 8 --timeout 0 app:app
CMD ["bash", "run.sh"]