Thinking / Dockerfile
mike23415's picture
Update Dockerfile
ae1011b verified
raw
history blame
1.08 kB
FROM python:3.10-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
git \
&& rm -rf /var/lib/apt/lists/*
# Create cache directories with proper permissions
RUN mkdir -p /cache /config && chmod 777 /cache /config
# Set environment variables to use the writable directories
ENV TRANSFORMERS_CACHE=/cache/huggingface
ENV HF_HOME=/cache/huggingface
ENV MPLCONFIGDIR=/config/matplotlib
# Copy requirements first for better caching
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application
COPY . .
# Set environment variables for non-interactive execution
ENV PYTHONUNBUFFERED=1
ENV TRANSFORMERS_NO_ADVISORY_WARNINGS=1
ENV HF_HUB_DISABLE_PROGRESS_BARS=1
ENV HF_HUB_DISABLE_TELEMETRY=1
# Add environment variable to enable wider GPU memory compatibility
ENV PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:128
# Expose the port the app runs on
EXPOSE 7860
EXPOSE 5000 # Also expose the Flask API port
# Command to run the application
CMD ["python", "app.py"]