Spaces:
Runtime error
Runtime error
# Use official Python image | |
FROM python:3.9-slim | |
# Set environment variables | |
ENV PYTHONDONTWRITEBYTECODE 1 | |
ENV PYTHONUNBUFFERED 1 | |
# Install system dependencies | |
RUN apt-get update && apt-get install -y \ | |
wget \ | |
unzip \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Set working directory | |
WORKDIR /app | |
# Copy requirements file and install dependencies | |
RUN --mount=type=cache,target=/root/.cache/pip \ | |
--mount=type=bind,source=requirements.txt,target=requirements.txt \ | |
python -m pip install -r requirements.txt | |
# Set the TRANSFORMERS_CACHE environment variable | |
ENV TRANSFORMERS_CACHE=/tmp/.cache/huggingface | |
# Create the cache folder with appropriate permissions | |
RUN mkdir -p $TRANSFORMERS_CACHE && chmod -R 777 $TRANSFORMERS_CACHE | |
# Copy application files | |
COPY . . | |
# Expose the port that the application listens on. | |
EXPOSE 8000 | |
# Run the application. | |
CMD uvicorn 'main:app' --host=0.0.0.0 --port=7860 |