Spaces:
Running
Running
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"] | |