Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files1234567891011121314151617181920212223242526272 unmodified lines30313233FROM 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 userUSER userENV HOME=/home/user \PATH=/home/user/.local/bin:$PATH \PORT=7860# Clone the repository and set up directoriesRUN --mount=type=secret,id=Access_key,mode=0444,required=true \git clone $(cat /run/secrets/Access_key) $HOME/app# Set working directory# Create and set working directoryWORKDIR $HOME/appRUN mkdir -p uploadsRUN mkdir -p temp# Install Python dependenciesRUN pip install --no-cache-dir --upgrade -r requirements.txt2 unmodified linesEXPOSE 7860# Start the applicationCMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]1234567891011121314151617181920212223242526272829303132333435362 unmodified lines39404142FROM python:3.9# Switch to root for system installationsUSER root# Install dependenciesRUN apt-get update && apt-get install -y \git \&& rm -rf /var/lib/apt/lists/*# Create non-root userRUN useradd -m -u 1000 userENV HOME=/home/user \PATH=/home/user/.local/bin:$PATH \PORT=7860# Clone repository as rootRUN --mount=type=secret,id=Access_key,mode=0444,required=true \git clone $(cat /run/secrets/Access_key) $HOME/app# Ensure non-root user has ownership of the cloned filesRUN chown -R user:user $HOME/app# Set working directoryWORKDIR $HOME/app# Create necessary directories with correct permissionsRUN mkdir -p uploads temp && \chown -R user:user uploads temp# Switch to non-root userUSER user# Install Python dependenciesRUN pip install --no-cache-dir --upgrade -r requirements.txt2 unmodified linesEXPOSE 7860# Start the applicationCMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
Dockerfile+17-8