File size: 1,112 Bytes
3301b3c 33f4e34 3301b3c 33f4e34 8c61032 69979b2 3301b3c 69979b2 8288e6d 69979b2 3301b3c 69979b2 8c61032 3301b3c 69979b2 d548227 3301b3c 33f4e34 3301b3c 33f4e34 |
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 37 38 39 40 41 42 43 44 45 46 |
# Base image
FROM python:3.10-slim
RUN useradd -m -u 1000 user
USER user
# Set working directory
WORKDIR /app
# System dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
ffmpeg \
# for hnswlib (needed for OpenMP)
libgomp1 \
curl \
git && \
rm -rf /var/lib/apt/lists/*
# Copy and install Python dependencies
COPY requirements.txt ./
RUN pip install uv && \
pip install detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cpu/torch2.1/index.html && \
uv pip install --no-cache-dir -r requirements.txt
# Download models (if needed at build time)
RUN curl -L https://github.com/opendatalab/MinerU/raw/dev/scripts/download_models_hf.py -o download_models_hf.py && \
python download_models_hf.py
# Copy application code
COPY src/ ./src/
# COPY tests/ ./tests/
COPY app.py .
# Expose Streamlit port
EXPOSE 7860
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV TOKENIZERS_PARALLELISM=false
# Start Streamlit
ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|