-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (26 loc) · 1.05 KB
/
Copy pathDockerfile
File metadata and controls
38 lines (26 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
FROM nvidia/cuda:12.4.1-runtime-ubuntu22.04 AS builder
RUN apt-get update && \
apt-get install -y --no-install-recommends python3.12 python3-pip git && \
rm -rf /var/lib/apt/lists/*
WORKDIR /build
COPY requirements.txt .
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
FROM nvidia/cuda:12.4.1-runtime-ubuntu22.04
RUN apt-get update && \
apt-get install -y --no-install-recommends python3.12 curl && \
rm -rf /var/lib/apt/lists/*
# Copy installed packages from builder stage
COPY --from=builder /install /usr/local
# Create non-root user
RUN useradd -m -s /bin/bash appuser && \
mkdir -p /home/appuser/.cache && \
chown -R appuser:appuser /home/appuser
WORKDIR /app
COPY --chown=appuser:appuser . .
# Switch to non-root user
USER appuser
EXPOSE 8501
# Healthcheck -- Streamlit exposes /_stcore/health
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:8501/_stcore/health || exit 1
CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]