Spaces:
Running
Running
File size: 878 Bytes
baafdc4 0d812de 4ee5e7c baafdc4 19ef158 f88a6bd 0d812de 60cfa47 699fa80 4ee5e7c f88a6bd 60cfa47 1ce23eb ef6684d 1ce23eb b20ce05 75f98be baafdc4 |
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 |
FROM python:3.10-slim
# Install required system packages
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
ffmpeg \
tesseract-ocr \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd -m -u 1000 user
ENV HOME=/home/user
USER user
WORKDIR /app
# Receive Git URL from build argument
RUN --mount=type=secret,id=URL,mode=0444,required=true \
git clone https://$(cat /run/secrets/URL) .
# Set up virtual environment and dependencies
RUN python -m venv shared_venv && \
shared_venv/bin/pip install --upgrade pip && \
shared_venv/bin/pip install --no-cache-dir -r requirements.txt && \
shared_venv/bin/pip install --no-cache-dir numpy && \
shared_venv/bin/python -m pip list > /app/pip_list.txt
EXPOSE 7860
CMD ["shared_venv/bin/python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|