xmem / Dockerfile
Olserra's picture
Update app.py to replace main.py as the entry point, integrate Gradio with FastAPI, and enhance the Dockerfile for improved dependency management and clarity. Update configuration files to reflect changes in app structure.
139c277
Raw History Blame Contribute Delete
803 Bytes
FROM python:3.11-slim
WORKDIR /app
# Install build tools for packages with C extensions
RUN apt-get update && apt-get install -y --no-install-recommends build-essential && rm -rf /var/lib/apt/lists/*
# Install Poetry
RUN pip install --no-cache-dir poetry
# Copy dependency files
COPY pyproject.toml poetry.lock ./
# Install dependencies
RUN poetry config virtualenvs.create false \
&& poetry install --no-interaction --no-ansi --no-root
# Copy the rest of the application
COPY . .
# Set Hugging Face cache
ENV HF_HOME=/app/.cache/huggingface
RUN mkdir -p /app/.cache/huggingface && chmod -R 777 /app/.cache
# Pre-download models
RUN python -c "from keybert import KeyBERT; KeyBERT()"
# Expose port (Gradio uses 7860 by default)
EXPOSE 7860
# Run Gradio with FastAPI
CMD ["python", "app.py"]