| FROM python:3.10-slim |
|
|
| WORKDIR /app |
|
|
| |
| RUN apt-get update && apt-get install -y \ |
| build-essential \ |
| curl \ |
| git \ |
| libfaiss-dev \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| RUN useradd --create-home --shell /bin/bash --uid 1000 appuser |
|
|
| |
| COPY requirements.txt . |
| RUN pip install --no-cache-dir --upgrade pip |
| RUN pip install --no-cache-dir -r requirements.txt |
|
|
| |
| ENV HF_HOME=/home/appuser/.cache/huggingface |
| ENV HF_HUB_CACHE=/home/appuser/.cache/huggingface/hub |
| ENV TRANSFORMERS_CACHE=/home/appuser/.cache/transformers |
| ENV SENTENCE_TRANSFORMERS_HOME=/home/appuser/.cache/sentence_transformers |
|
|
| |
| RUN mkdir -p /home/appuser/.cache/huggingface/hub \ |
| /home/appuser/.cache/transformers \ |
| /home/appuser/.cache/sentence_transformers \ |
| /app/uploads && \ |
| chown -R appuser:appuser /home/appuser/.cache /app && \ |
| chmod -R 755 /home/appuser/.cache /app |
|
|
| |
| COPY --chown=appuser:appuser . . |
|
|
| |
| USER appuser |
|
|
| |
| EXPOSE 7860 |
|
|
| |
| CMD ["python", "app.py"] |