|
|
|
|
|
FROM python:3.9-slim |
|
|
|
|
|
|
|
|
WORKDIR /app |
|
|
|
|
|
|
|
|
RUN apt-get update && apt-get install -y \ |
|
|
build-essential \ |
|
|
curl \ |
|
|
software-properties-common \ |
|
|
git \ |
|
|
libgl1-mesa-glx \ |
|
|
libglib2.0-0 \ |
|
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
|
|
|
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app |
|
|
|
|
|
|
|
|
USER appuser |
|
|
|
|
|
|
|
|
ENV STREAMLIT_CONFIG_DIR=/app/.streamlit |
|
|
ENV HF_HOME=/app/.cache/huggingface |
|
|
ENV STREAMLIT_SERVER_FILE_WATCHER_TYPE=none |
|
|
ENV PATH=/home/appuser/.local/bin:$PATH |
|
|
|
|
|
|
|
|
RUN mkdir -p /app/.streamlit /app/.cache/huggingface |
|
|
RUN chmod -R 777 /app/.streamlit /app/.cache |
|
|
|
|
|
|
|
|
COPY --chown=appuser:appuser requirements.txt ./ |
|
|
RUN pip3 install --user --no-cache-dir -r requirements.txt |
|
|
RUN pip3 install --user --no-cache-dir streamlit |
|
|
|
|
|
|
|
|
RUN streamlit --version || { echo "Streamlit installation failed"; exit 1; } |
|
|
|
|
|
|
|
|
COPY --chown=appuser:appuser src/ ./src/ |
|
|
COPY --chown=appuser:appuser modules/ ./modules/ |
|
|
|
|
|
|
|
|
EXPOSE 8501 |
|
|
|
|
|
|
|
|
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1 |
|
|
|
|
|
|
|
|
ENTRYPOINT ["/home/appuser/.local/bin/streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"] |