|
|
|
FROM python:3.12-slim |
|
|
|
|
|
ENV PYTHONUNBUFFERED=1 \ |
|
POETRY_VERSION=1.7.1 \ |
|
POETRY_HOME="/opt/poetry" \ |
|
POETRY_NO_INTERACTION=1 \ |
|
GRADIO_SERVER_NAME=0.0.0.0 \ |
|
GRADIO_SERVER_PORT=7860 |
|
|
|
|
|
WORKDIR /app |
|
|
|
|
|
ENV HF_HOME=/app/.cache/huggingface |
|
RUN mkdir -p /app/.cache/huggingface && \ |
|
mkdir -p /app/.cache/torch && \ |
|
mkdir -p /app/.cache/transformers |
|
|
|
|
|
RUN apt-get update && apt-get install -y \ |
|
portaudio19-dev \ |
|
python3-pip \ |
|
gcc \ |
|
git \ |
|
curl \ |
|
&& rm -rf /var/lib/apt/lists/* \ |
|
&& apt-get clean |
|
|
|
|
|
RUN pip install poetry==${POETRY_VERSION} && \ |
|
poetry config virtualenvs.create false |
|
|
|
|
|
COPY pyproject.toml poetry.lock ./ |
|
|
|
|
|
RUN poetry install --no-dev --no-interaction --no-ansi |
|
|
|
|
|
RUN groupadd -r app --gid 1000 && \ |
|
useradd -r -g app --uid 1000 --create-home app |
|
|
|
|
|
RUN chown -R app:app /app/.cache && \ |
|
chmod -R 755 /app/.cache |
|
|
|
|
|
RUN mkdir -p /home/app/.cache && \ |
|
mkdir -p /home/app/.config/matplotlib && \ |
|
chown -R app:app /home/app/.cache && \ |
|
chown -R app:app /home/app/.config |
|
|
|
|
|
ENV MPLCONFIGDIR=/home/app/.config/matplotlib |
|
|
|
|
|
USER app |
|
|
|
|
|
COPY --chown=app:app . . |
|
|
|
|
|
EXPOSE 7860 |
|
|
|
|
|
CMD ["python", "app.py"] |
|
|