|
|
|
|
|
|
|
FROM python:3.9.15-slim-bullseye as compile-image
|
|
|
|
ENV POETRY_VERSION=1.5.1
|
|
|
|
RUN export DEBIAN_FRONTEND=noninteractive && \
|
|
apt-get update && \
|
|
apt-get install cmake build-essential -y --no-install-recommends && \
|
|
pip install poetry==$POETRY_VERSION
|
|
|
|
|
|
|
|
COPY ./pyproject.toml ./app/init_jptalk.py ./poetry.lock ./
|
|
RUN poetry export -f requirements.txt -o requirements.txt && \
|
|
python -m venv /opt/venv && \
|
|
/opt/venv/bin/pip install --no-cache-dir -U pip && \
|
|
/opt/venv/bin/pip install --no-cache-dir -r requirements.txt && \
|
|
/opt/venv/bin/python3 init_jptalk.py
|
|
|
|
|
|
FROM python:3.9.15-slim-bullseye as final
|
|
EXPOSE 7860
|
|
COPY --from=compile-image /opt/venv /opt/venv
|
|
|
|
ENV TZ=Asia/Shanghai PATH="/opt/venv/bin:$PATH"
|
|
COPY ./app /app
|
|
WORKDIR /
|
|
|
|
RUN mkdir -p /app/.model && \
|
|
chmod 777 -R /app
|
|
|
|
|
|
|
|
CMD ["python", "-m","app.main"] |