|
|
|
|
|
|
|
FROM python:3.9-slim |
|
|
|
|
|
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
RUN useradd -m -u 1000 appuser |
|
|
|
|
|
WORKDIR /app |
|
|
|
|
|
ENV HOME=/app |
|
|
|
|
|
ENV STREAMLIT_CONFIG_DIR=/app/.streamlit \ |
|
HF_HOME=/app/.cache/huggingface \ |
|
XDG_CACHE_HOME=/app/.cache \ |
|
STREAMLIT_HOME=/app/.cache/streamlit \ |
|
PATH=/app/.local/bin:$PATH |
|
|
|
|
|
RUN mkdir -p /app/.streamlit \ |
|
&& mkdir -p /app/.cache/huggingface/hub \ |
|
&& mkdir -p /app/.cache/streamlit \ |
|
&& chmod -R 755 /app/.cache /app/.streamlit \ |
|
&& chown -R appuser:appuser /app |
|
|
|
|
|
RUN pip install --upgrade pip |
|
|
|
|
|
COPY requirements.txt . |
|
|
|
|
|
USER appuser |
|
RUN pip install --no-cache-dir -r requirements.txt |
|
|
|
|
|
COPY --chown=appuser:appuser src/ ./src |
|
|
|
|
|
RUN if [ -f /app/src/.streamlit/config.toml ]; then \ |
|
mv /app/src/.streamlit/config.toml /app/.streamlit/config.toml && \ |
|
chmod 644 /app/.streamlit/config.toml; \ |
|
fi |
|
|
|
|
|
EXPOSE 8501 |
|
|
|
|
|
HEALTHCHECK --interval=30s --timeout=3s \ |
|
CMD curl -f http://localhost:8501/healthz || exit 1 |
|
|
|
|
|
CMD ["/app/.local/bin/streamlit", "run", "src/app.py", \ |
|
"--server.port=8501", \ |
|
"--server.address=0.0.0.0"] |