omniparser-url / Dockerfile
Netrava's picture
Update Dockerfile
3528d52 verified
Raw History Blame Contribute Delete
1.38 kB
# Use the official Python 3.10 image as a base
FROM python:3.10-slim
# Set the working directory inside the container
WORKDIR /code
# Set an environment variable to prevent prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
# --- NEW SECTION: CREATE A WRITABLE DIRECTORY FOR ALL CACHES ---
# Create a directory that any user can write to for cache files.
RUN mkdir -p /data/huggingface && \
mkdir -p /data/ultralytics && \
mkdir -p /data/paddle && \
chmod -R 777 /data
# Tell all the libraries to use this new writable directory for their caches.
ENV HF_HOME=/data/huggingface
ENV HUGGINGFACE_HUB_CACHE=/data/huggingface
ENV TRANSFORMERS_CACHE=/data/huggingface
ENV YOLO_CONFIG_DIR=/data/ultralytics
ENV PADDLE_HOME=/data/paddle
ENV MPLCONFIGDIR=/data/matplotlib
# Install missing system-level dependencies required by OpenCV (cv2)
RUN apt-get update && \
apt-get install -y libgl1-mesa-glx libglib2.0-0 ffmpeg libsm6 libxext6 && \
apt-get clean
# Copy the requirements file into the container
COPY requirements.txt .
# Install the Python dependencies from requirements.txt
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy the application file into the container
COPY app.py .
# Command to run the Gradio application when the container starts
CMD ["python", "app.py"]