Spaces:
Build error
Build error
# Use the official Python image from the Docker Hub | |
FROM python:3.9-slim | |
# Set the working directory in the container | |
WORKDIR /app | |
# Install system dependencies | |
RUN apt-get update && apt-get install -y wget git tar && rm -rf /var/lib/apt/lists/* | |
# Create a Hugging Face cache directory | |
RUN mkdir -p /app/.cache/huggingface && chmod -R 777 /app/.cache/huggingface | |
# Set environment variables | |
ENV HF_HOME=/app/.cache/huggingface | |
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface | |
# Create and activate a virtual environment | |
RUN python3 -m venv /app/venv | |
ENV PATH="/app/venv/bin:$PATH" | |
# Configure Git | |
RUN git config --system user.email "[email protected]" && \ | |
git config --system user.name "peace2024" | |
# Copy the requirements file | |
COPY requirements.txt . | |
# Install dependencies in the virtual environment | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy the application code | |
COPY app.py . | |
# Expose the port FastAPI runs on | |
EXPOSE 8000 | |
# Command to run the application | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"] | |