Juna190825's picture
Update Dockerfile
1d6b569 verified
raw
history blame contribute delete
990 Bytes
# Use official Python image
FROM python:3.9-slim
# Set working directory
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 /app/cache/huggingface \
&& mkdir -p /app/cache/matplotlib \
&& chmod -R 777 /app/cache
# Copy requirements first to leverage Docker cache
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cpu
RUN pip install git+https://github.com/casper-hansen/AutoAWQ.git
# Copy the rest of the application
COPY . .
# Set environment variables for cache directories
ENV HUGGINGFACE_HUB_CACHE=/app/cache/huggingface
ENV TRANSFORMERS_CACHE=/app/cache/huggingface
ENV MPLCONFIGDIR=/app/cache/matplotlib
ENV MAX_CPU_RAM=16
# Expose port
EXPOSE 7860
# Run the application
CMD ["python", "app.py"]