Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files1234567891011121314151617181920212223242526272829303132# Use Python 3.10 slim image as baseFROM python:3.10-slim# Create non-root userRUN useradd -m -u 1000 userRUN apt-get update && apt-get install -y git# Set environment variablesENV HOME=/home/user \PATH=/home/user/.local/bin:$PATH \PORT=7860# Create and set working directoryWORKDIR $HOME/app# Clone the repository and move files without creating an extra folderRUN git clone https://github.com/charan200415/FileToLink temp && \shopt -s dotglob && \mv temp/* ./ && \rmdir temp# Switch to non-root userUSER user# Install dependenciesRUN pip install --user -r requirements.txt# Expose portEXPOSE ${PORT}# Command to run the applicationCMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--reload"]123456789101112131415161718192021222324252627FROM python:3.9# Switch to root for system installationsUSER root# Install Tesseract and language dataRUN apt-get update && apt-get install -y \git \&& rm -rf /var/lib/apt/lists/*# Create user and set up environmentRUN useradd -m -u 1000 user && \chown -R user:user /usr/share/tesseract-ocr/4.00/tessdataRUN --mount=type=secret,id=Access_key,mode=0444,required=true \git clone $(cat /run/secrets/Access_key) /appWORKDIR /app# Switch to user for pip installationsUSER userENV PATH="/home/user/.local/bin:$PATH"# Install Python dependenciesRUN pip install --no-cache-dir --upgrade -r requirements.txt# Copy application filesCMD ["gunicorn", "-b", "0.0.0.0:7860", "--timeout", "300", "--workers", "2", "--threads", "4", "app:app"]
Dockerfile+19-24