texttoimage / Dockerfile
Abdurrehman015's picture
firstCommit7
f049b64
raw
history blame contribute delete
710 Bytes
FROM python:3.9-slim
WORKDIR /app
# Install required system packages
RUN apt-get update && apt-get install -y \
libgl1-mesa-glx \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY requirements.txt .
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY main.py .
# Create writable cache directory for Hugging Face
RUN mkdir -p /app/hf_cache && chmod -R 777 /app/hf_cache
ENV HF_HOME=/app/hf_cache
# Optional: Pass your Hugging Face token
ENV HF_TOKEN=$HF_TOKEN
# Expose port for Uvicorn
EXPOSE 8000
# Run the FastAPI app (from main.py)
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]