ARG IMAGE=harbor.hgj.net/ai/sheldonlee-python3.12:latest

FROM ${IMAGE}

RUN python3.12 -m pip install pip --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple --no-cache-dir

COPY requirements.txt /app/requirements.txt
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --no-cache-dir -r /app/requirements.txt

COPY requirements_wheels.txt /app/requirements_wheels.txt
RUN pip install --no-cache-dir -r /app/requirements_wheels.txt || true

COPY __SERVICE_NAME__ /app/__SERVICE_NAME__
COPY pyproject.toml /app/pyproject.toml
RUN cd /app && python3.12 -m pip install -e . -i https://pypi.tuna.tsinghua.edu.cn/simple --no-cache-dir

VOLUME [ "/data" ]
VOLUME [ "/resource" ]

ENV IS_DEBUG=False
ENV DATA_ROOT=/data
ENV RESOURCE_ROOT=/resource

COPY start_server.sh /app/start_server.sh
WORKDIR /app
CMD ["bash", "start_server.sh"]
