Spaces:
Running
Running
File size: 953 Bytes
e7b1e22 5bb4004 e7b1e22 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
FROM python:3.11-slim
# Set environment variables (may need to change authority)
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
# Create working directory (and authorised token)
WORKDIR /app
# Add to Dockerfile
ENV TRANSFORMERS_CACHE=/app/model_cache
ENV HF_HOME=/app/.cache/huggingface
ENV SENTENCE_TRANSFORMERS_HOME=/app/.cache/huggingface/sentence-transformers
# Install SSL root certs and system deps required by pymongo + DNS
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates curl dnsutils gcc openssl && \
rm -rf /var/lib/apt/lists/*
# Copy and install dependencies
COPY requirements.txt .
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
# Copy source code (app files)
COPY . .
# Expose the port used by Uvicorn
EXPOSE 7860
# Run the FastAPI application using Uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--log-level", "debug"]
|