# 📚 Base image with CUDA for ML FROM nvidia/cuda:12.2.0-base-ubuntu22.04 # 🛠️ Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ python3.11 \ python3.11-dev \ python3-pip \ build-essential \ curl \ && rm -rf /var/lib/apt/lists/* \ && apt-get clean # 🔗 Set Python 3.11 as default RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1 \ && update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 # 📂 Set working directory WORKDIR /home/user/app # 🐍 Install Python dependencies COPY ./requirements.txt . RUN pip install --no-cache-dir --upgrade pip \ && pip install --no-cache-dir -r requirements.txt \ && pip install --no-cache-dir \ https://huggingface.co/spacy/en_core_web_sm/resolve/main/en_core_web_sm-any-py3-none-any.whl \ https://huggingface.co/spacy/en_core_web_lg/resolve/main/en_core_web_lg-any-py3-none-any.whl # 🔒 Create non-root user RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # 📦 Copy application code COPY --chown=user . . # 🌐 Expose port EXPOSE 7860 # 🩺 Healthcheck HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health || exit 1 # 🚀 Run application CMD ["python3", "-m", "streamlit", "run", "presidio_streamlit.py", "--server.port=7860", "--server.address=0.0.0.0"]