# Use an official Python image as a base FROM python:3.10 # Set the working directory WORKDIR /app # Copy requirements and install dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt ENV TRANSFORMERS_CACHE=/app/cache # Copy the application code COPY . . # Download the Hugging Face model during the build process # RUN python -c "from transformers import AutoTokenizer, AutoModelForCausalLM; \ # model_path = 'model/models--meta-llama--Llama-3.2-3B-Instruct/snapshots/0cb88a4f764b7a12671c53f0838cd831a0843b95'; \ # AutoTokenizer.from_pretrained(model_path); \ # AutoModelForCausalLM.from_pretrained(model_path)" # Expose the default port EXPOSE 7860 # Start the FastAPI app using Uvicorn CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]