casmopedia / Dockerfile
aradhyapavan's picture
Update Dockerfile
8c3c9b6 verified
raw
history blame contribute delete
779 Bytes
FROM python:3.11-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for better caching
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Create necessary directories
RUN mkdir -p static/css static/js templates data
# Expose port for Hugging Face Spaces
EXPOSE 7860
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV PORT=7860
ENV TRANSFORMERS_CACHE=/app/.cache
ENV HF_HOME=/app/.cache
# Create cache directory with proper permissions
RUN mkdir -p /app/.cache && chmod 777 /app/.cache
# Command to run the application
CMD ["python", "app.py"]