FROM python:3.10-slim AS base

LABEL maintainer="xujiawei@cocorobo.cc"

RUN apt-get update \
    && apt-get install -y --no-install-recommends bash curl wget vim libmagic-dev \
    && apt-get autoremove \
    && rm -rf /var/lib/apt/lists/*

RUN pip install --no-cache-dir poetry -i https://pypi.tuna.tsinghua.edu.cn/simple \
    && poetry config virtualenvs.create false

#COPY poetry.lock /env/poetry.lock
COPY pyproject.toml /env/pyproject.toml


#RUN poetry config repositories.pypi https://pypi.tuna.tsinghua.edu.cn/simple
#RUN cd /env && poetry lock --no-update && poetry install --only main
#RUN cd /env && poetry install --only main
RUN cd /env && poetry lock && poetry install --only main
#RUN pip install openai==1.27.0 -i https://pypi.tuna.tsinghua.edu.cn/simple

EXPOSE 8086

WORKDIR /app

COPY . /app

COPY docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
