Update Dockerfile
Browse files- Dockerfile +23 -15
Dockerfile
CHANGED
@@ -1,25 +1,33 @@
|
|
1 |
FROM python:3.10-slim
|
2 |
|
3 |
-
WORKDIR /
|
4 |
|
5 |
-
# Install system
|
6 |
-
RUN apt-get update \
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
9 |
|
10 |
-
#
|
11 |
COPY requirements.txt .
|
|
|
|
|
12 |
|
13 |
-
#
|
14 |
-
RUN
|
15 |
|
16 |
-
#
|
17 |
-
|
18 |
-
&& pip install --no-cache-dir -r requirements.txt
|
19 |
|
20 |
-
#
|
21 |
-
RUN
|
|
|
22 |
|
23 |
-
|
|
|
|
|
24 |
|
25 |
-
|
|
|
|
1 |
FROM python:3.10-slim
|
2 |
|
3 |
+
WORKDIR /app
|
4 |
|
5 |
+
# Install system dependencies + Streamlit requirements
|
6 |
+
RUN apt-get update && \
|
7 |
+
apt-get install -y --no-install-recommends \
|
8 |
+
build-essential \
|
9 |
+
gcc \
|
10 |
+
libgomp1 \
|
11 |
+
&& rm -rf /var/lib/apt/lists/*
|
12 |
|
13 |
+
# Install Python dependencies first for caching
|
14 |
COPY requirements.txt .
|
15 |
+
RUN pip install --upgrade pip && \
|
16 |
+
pip install --no-cache-dir -r requirements.txt
|
17 |
|
18 |
+
# Verify Streamlit installation
|
19 |
+
RUN which streamlit && streamlit --version
|
20 |
|
21 |
+
# Copy application files
|
22 |
+
COPY . .
|
|
|
23 |
|
24 |
+
# Set up non-root user
|
25 |
+
RUN useradd -m appuser && chown -R appuser:appuser /app
|
26 |
+
USER appuser
|
27 |
|
28 |
+
# Health check (optional but recommended)
|
29 |
+
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
|
30 |
+
CMD curl -f http://localhost:7860/health || exit 1
|
31 |
|
32 |
+
# Run Streamlit
|
33 |
+
CMD ["streamlit", "run", "app.py", "--server.address=0.0.0.0", "--server.port=7860"]
|