FROM python:3.10.9 # Create user with home directory RUN useradd -m -u 1000 user # Switch to the created user USER user # Set environment variables ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH \ TRANSFORMERS_CACHE=/home/user/.cache # Create necessary directories with the right permissions RUN mkdir -p $HOME/.cache && chmod -R 777 $HOME/.cache # Set the working directory WORKDIR $HOME/Redaction # Copy project files to the working directory COPY --chown=user . $HOME/Redaction # Install dependencies RUN pip install --no-cache-dir --upgrade -r requirements.txt # Set the command to run the application CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]