FROM SXKJ:32775/yiliocr-layout:test-2023-08-26_11-57-27

WORKDIR /workspace
RUN rm -rf ./*
ADD requirements.txt .
RUN ln -s  /opt/conda/bin/pip /usr/local/bin/pip
RUN pip install -r requirements.txt -i  https://mirror.baidu.com/pypi/simple
# ADD environment.yml /environment.yml
# RUN sed -i 's#- paddlepaddle#- paddlepaddle-gpu==2.3.0.post110#g' /environment.yml && cat /environment.yml
#RUN conda update -n base -c defaults conda -y && conda env update -f /environment.yml && rm -rf /root/.cache
# RUN mamba update -n base -c defaults conda -y && mamba env create -f /environment.yml && rm -rf /root/.cache

RUN echo "\
[program:be]\n\
directory=/workspace\n\
command=/opt/conda/bin/python run.py \n\
autorestart=true\n\
startretries=0\n\
redirect_stderr=true\n\
stdout_logfile=/var/log/be.log\n\
stdout_logfile_maxbytes=50MB\n\
environment=CUDA_VISIBLE_DEVICES=0,PYTHONPATH=/worksapce/yolov7\n\
" > /etc/supervisor/conf.d/be.conf

# envs/py38/

RUN git clone http://gogs.soaringnova.com/sxwl_DL/yolov7.git
RUN wget  ftp://192.168.199.31/yiliv7_718.pt
# RUN wget  ftp://192.168.199.31/logo.pt

RUN mkdir -p models
RUN cd models && wget ftp://192.168.199.31/yolov7p6_e6_300e/20240314/yolov7p6_e6_300e_coco.zip && unzip yolov7p6_e6_300e_coco.zip && rm yolov7p6_e6_300e_coco.zip

ADD . /workspace
# FIXME: replace with environment variables
RUN sed -i 's/device = "cpu"/device = "gpu"/g' core/detectors/paddle_yolo/__init__.py && cat core/detectors/paddle_yolo/__init__.py
EXPOSE 8080



# RUN mamba install -y jupyterlab -n base && mamba init zsh
# RUN /opt/conda/bin/jupyter notebook --generate-config && \
#     echo "c.NotebookApp.password='argon2:\$argon2id\$v=19\$m=10240,t=10,p=8\$+zIUCF9Uk2FiCHlV8njX5A\$I5Mm/64DORArcXYTXWRVng'">>/root/.jupyter/jupyter_notebook_config.py


# RUN mkdir -p /data && echo "\
# [program:jupyter]\n\
# directory=/data\n\
# command=/opt/conda/bin/jupyter lab --ip 0.0.0.0 --port 8888 --allow-root --no-browser \n\
# autorestart=true\n\
# startretries=0\n\
# redirect_stderr=true\n\
# stdout_logfile=/dev/stdout\n\
# stdout_logfile_maxbytes=0\n\
# " > /etc/supervisor/conf.d/jupyter.conf

# EXPOSE 8888
