trygithubactions / Dockerfile
subashpoudel's picture
Added docker file for containerization
1423dd9
raw
history blame
626 Bytes
# Use an official Python image
FROM python:3.12-slim
# Set working directory
WORKDIR /app
# Create a cache directory with proper permissions
RUN mkdir -p /data/.cache/huggingface && chmod -R 777 /data
# Set environment variables for Hugging Face cache
ENV HF_HOME=/data/.cache/huggingface
ENV TRANSFORMERS_CACHE=/data/.cache/huggingface/transformers
ENV HF_DATASETS_CACHE=/data/.cache/huggingface/datasets
# Copy code
COPY . .
# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Expose the port
EXPOSE 7860
# Run the FastAPI app
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]