Spaces:
Sleeping
Sleeping
| # π 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"] |