AperPhil / Dockerfile
luciagomez's picture
Update Dockerfile
92bea24 verified
raw
history blame contribute delete
905 Bytes
# Use a lightweight Python base image (CPU only)
FROM python:3.11-slim
# Environment variables
ENV HF_HOME=/app/hf_cache \
TRANSFORMERS_CACHE=/app/hf_cache \
GRADIO_SERVER_NAME=0.0.0.0 \
GRADIO_SERVER_PORT=7860 \
PYTHONUNBUFFERED=1 \
TOKENIZERS_PARALLELISM=false
# Set working directory
WORKDIR /app
# Install system dependencies (needed by torch/transformers)
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
wget \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Create cache directory with open permissions
RUN mkdir -p /app/hf_cache && chmod -R 777 /app/hf_cache
# Copy requirements first for Docker cache efficiency
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the app
COPY . .
# Expose Gradio port
EXPOSE 7860
# Run the app
CMD ["python", "app.py"]