File size: 853 Bytes
7c544a2 4a0eae0 7c544a2 4a0eae0 7c544a2 4a0eae0 7c544a2 4a0eae0 7c544a2 d3012e4 4a0eae0 7182a4b 4a0eae0 7c544a2 b3d7227 | 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 30 31 | # Use an official Python runtime as the base image
FROM python:3.10-slim
# Set the working directory
WORKDIR /app
# Install system dependencies (if needed for your model, e.g., libssl, gcc, etc.)
RUN apt-get update && apt-get install -y \
build-essential \
curl \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy the current directory content into the container at /app
COPY . /app
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Set the environment variable for Hugging Face cache
ENV TRANSFORMERS_CACHE=/app/.cache
# Make sure the cache directory exists and has the right permissions
RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache
# Expose the FastAPI app port
EXPOSE 7860
# Define the command to run your application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|