|
FROM python:3.9-slim |
|
|
|
WORKDIR /app |
|
|
|
|
|
RUN apt-get update && apt-get install -y \ |
|
libgl1-mesa-glx \ |
|
libglib2.0-0 \ |
|
libsm6 \ |
|
libxext6 \ |
|
libxrender-dev \ |
|
libgomp1 \ |
|
wget \ |
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
COPY requirements.txt ./ |
|
RUN pip3 install --no-cache-dir -r requirements.txt |
|
|
|
|
|
COPY . . |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RUN groupadd --system appuser && useradd --system --gid appuser appuser |
|
|
|
|
|
RUN chown -R appuser:appuser /app |
|
|
|
|
|
ENV HOME=/app |
|
|
|
|
|
ENV YOLO_CONFIG_DIR=/tmp |
|
|
|
|
|
ENV SPACE_ID=huggingface |
|
ENV STREAMLIT_SERVER_HEADLESS=true |
|
ENV STREAMLIT_SERVER_ENABLE_CORS=false |
|
ENV STREAMLIT_SERVER_ENABLE_XSRF_PROTECTION=false |
|
|
|
|
|
USER appuser |
|
|
|
|
|
RUN mkdir -p /tmp/streamlit |
|
|
|
|
|
EXPOSE 8501 |
|
|
|
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ |
|
CMD curl -f http://localhost:8501/_stcore/health || exit 1 |
|
|
|
|
|
ENTRYPOINT ["streamlit", "run", "streamlit_app.py", \ |
|
"--server.port=8501", \ |
|
"--server.address=0.0.0.0", \ |
|
"--browser.gatherUsageStats=false", \ |
|
"--server.headless=true", \ |
|
"--server.enableCORS=false", \ |
|
"--server.enableXsrfProtection=false", \ |
|
"--server.maxUploadSize=200"] |