# Use an official Python runtime as the base image FROM python:3.10 # Set environment variables for Hugging Face cache (FIX: Use /tmp) ENV TRANSFORMERS_CACHE=/tmp ENV HF_HOME=/tmp ENV HF_MODULES_CACHE=/tmp # Set the working directory in the container WORKDIR /app # Copy the FastAPI application code COPY server.py /app/server.py # Install necessary dependencies RUN pip install --no-cache-dir fastapi uvicorn transformers torch sentencepiece # Expose the FastAPI port EXPOSE 7860 # Run the FastAPI server CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]