Portfolio1 / Dockerfile
PranavReddy18's picture
Upload Dockerfile
63f0e90 verified
raw
history blame contribute delete
861 Bytes
FROM python:3.11-slim
# Prevent python from writing .pyc files and enable unbuffered logs
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/app/src
# ✅ Redirect HuggingFace cache to a writable directory
ENV HF_HOME=/tmp/huggingface
ENV TRANSFORMERS_CACHE=/tmp/huggingface/transformers
ENV HF_DATASETS_CACHE=/tmp/huggingface/datasets
ENV HF_MODULES_CACHE=/tmp/huggingface/modules
WORKDIR /app
# Install dependencies
RUN apt-get update && apt-get install -y \
build-essential \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy project files
COPY . .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Expose port
EXPOSE 8000
# Run app
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]