|
FROM python:3.11-slim |
|
|
|
|
|
WORKDIR /app |
|
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 |
|
ENV PYTHONUNBUFFERED=1 |
|
ENV PYTHONPATH=/app |
|
|
|
|
|
RUN apt-get update && apt-get install -y \ |
|
build-essential \ |
|
curl \ |
|
git \ |
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
COPY requirements.txt . |
|
|
|
|
|
RUN pip install --no-cache-dir --upgrade pip==23.3.1 && \ |
|
pip install --no-cache-dir wheel setuptools && \ |
|
pip install --no-cache-dir torch==2.1.1 torchvision==0.16.1 torchaudio==2.1.1 --index-url https://download.pytorch.org/whl/cpu && \ |
|
pip install --no-cache-dir numpy==1.24.3 && \ |
|
pip install --no-cache-dir tokenizers==0.15.0 && \ |
|
pip install --no-cache-dir huggingface-hub==0.17.3 && \ |
|
pip install --no-cache-dir transformers==4.35.2 && \ |
|
pip install --no-cache-dir sentence-transformers==2.2.2 && \ |
|
pip install --no-cache-dir -r requirements.txt |
|
|
|
|
|
COPY . . |
|
|
|
|
|
RUN mkdir -p /app/data /app/logs |
|
|
|
|
|
RUN useradd --create-home --shell /bin/bash app && \ |
|
chown -R app:app /app |
|
USER app |
|
|
|
|
|
EXPOSE 8000 |
|
|
|
|
|
|
|
|
|
|
|
|
|
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--timeout-keep-alive", "0"] |