|
FROM python:3.10-slim |
|
|
|
|
|
RUN apt-get update && apt-get install -y \ |
|
build-essential \ |
|
git \ |
|
libgl1-mesa-glx \ |
|
libglib2.0-0 \ |
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
RUN useradd -m -u 1000 appuser |
|
|
|
|
|
WORKDIR /app |
|
|
|
|
|
RUN mkdir -p /app/.triton /app/.torch_cache /app/tmp && \ |
|
chmod 777 /app/tmp && \ |
|
chown -R appuser:appuser /app |
|
|
|
|
|
ENV TRITON_CACHE_DIR=/app/.triton |
|
ENV TORCH_HOME=/app/.torch_cache |
|
ENV TORCHINDUCTOR_CACHE_DIR=/app/.torch_cache/inductor |
|
ENV TEMP=/app/tmp |
|
ENV TMP=/app/tmp |
|
ENV TMPDIR=/app/tmp |
|
|
|
|
|
COPY requirements.txt . |
|
|
|
|
|
RUN pip install --no-cache-dir -r requirements.txt |
|
|
|
|
|
COPY . . |
|
|
|
|
|
RUN mkdir -p /app/.streamlit |
|
RUN echo '[server]\nheaderless = true\nenableCORS = false\nenableXsrfProtection = false' > /app/.streamlit/config.toml |
|
RUN chown -R appuser:appuser /app/.streamlit |
|
|
|
|
|
RUN mkdir -p /home/appuser/.streamlit |
|
RUN echo '[general]\nemail = ""' > /home/appuser/.streamlit/credentials.toml |
|
RUN chown -R appuser:appuser /home/appuser/.streamlit |
|
|
|
|
|
RUN chown -R appuser:appuser /app |
|
|
|
|
|
USER appuser |
|
|
|
|
|
EXPOSE 8501 |
|
|
|
|
|
CMD ["streamlit", "run", "app.py", "--server.address=0.0.0.0", "--server.enableCORS=false", "--server.enableXsrfProtection=false", "--server.maxUploadSize=50"] |