# Base Image FROM python:3.9 # Create a user RUN useradd -m -u 1000 user # Switch to user USER user # Set environment variables ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # Set working directory WORKDIR $HOME/app # Switch back to root to install dependencies USER root # Copy requirements and install dependencies COPY ./requirements.txt /code/requirements.txt RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt # Copy the JSON file and set permissions COPY --chown=user ./fruitful_patterns.json $HOME/app/fruitful_patterns.json RUN chmod 644 $HOME/app/fruitful_patterns.json # Download spaCy model RUN python -m spacy download en_core_web_md # Switch to user USER user # Copy the rest of the code COPY --chown=user . $HOME/app # Set CMD CMD ["streamlit", "run", "app.py", "--server.address=0.0.0.0", "--server.port=7860"]