presidio-de-identify / Dockerfile.v2.CUDA.HPC
awacke1's picture
Rename Dockerfile to Dockerfile.v2.CUDA.HPC
cb64fdc verified
# πŸ“š 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"]