Spaces:
Runtime error
Runtime error
File size: 1,013 Bytes
6cb2fb4 6d43bdb 885a9dd 6cb2fb4 885a9dd 6cb2fb4 93c9f38 91b9efe 6cb2fb4 cb5fa7f 6cb2fb4 cb5fa7f 93c9f38 cb5fa7f 885a9dd 6cb2fb4 885a9dd 13a265c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# Use Python 3.11 slim image
FROM python:3.11-slim
# Ensure we run as root (the default) so we can set permissions
USER root
# Install system dependencies
RUN apt-get update && apt-get install -y wget && rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Create and set permissions for cache directories
RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache \
&& mkdir -p /app/.config/matplotlib && chmod -R 777 /app/.config/matplotlib \
&& mkdir -p /.EasyOCR && chmod -R 777 /.EasyOCR
# Set environment variables for cache directories
ENV HF_HOME=/app/.cache
ENV XDG_CACHE_HOME=/app/.cache
ENV MPLCONFIGDIR=/app/.config/matplotlib
ENV USER_AGENT="my-gradio-app"
ENV EASYOCR_CACHE_DIR=/app/.EasyOCR
# Copy the requirements file and install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application code
COPY . .
# Expose the port for Gradio (Spaces expects the app on port 7860)
EXPOSE 7860
CMD ["python", "app.py"]
|