predictiveMaintanence / DockerFile
Shalyn's picture
Upload folder using huggingface_hub
eba542f verified
raw
history blame contribute delete
959 Bytes
# Use a Python version compatible with your packages
FROM python:3.12-slim
# Set working directory
WORKDIR /app
# Install system dependencies needed for pandas, numpy, scikit-learn, xgboost
RUN apt-get update && apt-get install -y \
build-essential \
gfortran \
libopenblas-dev \
liblapack-dev \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first (to leverage Docker caching)
COPY requirements.txt .
# Upgrade pip and install Python dependencies
RUN python3 -m pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
# Add non-root user
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set working directory to user home
WORKDIR $HOME/app
# Copy application code
COPY --chown=user . $HOME/app
# Run Streamlit app
CMD ["streamlit","run","app.py","--server.port=8501","--server.address=0.0.0.0","--server.enableXsrfProtection=false"]