Spaces:
Runtime error
Runtime error
File size: 873 Bytes
0b42132 a879d14 c905e5e 0b42132 a879d14 0b42132 a879d14 0b42132 c905e5e 0b42132 c905e5e 0b42132 a879d14 c905e5e 0b42132 c905e5e 0b42132 c905e5e f15f261 f3db870 |
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 |
# Use a lightweight Python 3.9 image
FROM python:3.9-slim
# Set environment variables for Python and Hugging Face cache
ENV PYTHONUNBUFFERED=1
ENV TRANSFORMERS_CACHE="/tmp/cache/huggingface/transformers"
ENV HF_HOME="/tmp/cache/huggingface"
# Create a non-root user and switch to it
RUN useradd -m -u 1000 user
USER user
# Set the working directory
WORKDIR /app
# Copy the requirements file and install dependencies
COPY --chown=user ./requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r /app/requirements.txt
# Copy the rest of the application code
COPY --chown=user . /app
# Expose port 7860 (required by Hugging Face Spaces)
EXPOSE 7860
# Start the FastAPI app using uvicorn via python -m to ensure it's found
CMD ["python", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|