Spaces:
Running
Running
Upload Dockerfile
Browse files- Dockerfile +18 -18
Dockerfile
CHANGED
@@ -1,28 +1,28 @@
|
|
1 |
-
# Dockerfile
|
2 |
FROM python:3.10-slim
|
3 |
|
|
|
4 |
WORKDIR /app
|
5 |
-
# tells the system to treat /app as the "home" directory, so Streamlit will create /app/.streamlit instead of /.streamlit.
|
6 |
-
# /app is already writable as root, so no permission issues.
|
7 |
-
ENV HOME=/app
|
8 |
|
|
|
|
|
|
|
9 |
|
|
|
|
|
|
|
|
|
10 |
|
11 |
-
#
|
12 |
-
|
13 |
|
14 |
-
#
|
15 |
-
|
16 |
-
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
|
17 |
|
18 |
-
#
|
19 |
-
|
20 |
|
21 |
-
#
|
22 |
-
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
# CMD ["bash", "-lc", "streamlit run /app/frontend.py --server.port $PORT --server.address 0.0.0.0"]
|
27 |
-
# CMD ["sh", "-c", "streamlit run /app/frontend.py --server.port $PORT --server.address 0.0.0.0"]
|
28 |
-
CMD ["streamlit", "run", "/app/frontend.py", "--server.port", "8501", "--server.address", "0.0.0.0"]
|
|
|
|
|
1 |
FROM python:3.10-slim
|
2 |
|
3 |
+
# Set working directory in the container
|
4 |
WORKDIR /app
|
|
|
|
|
|
|
5 |
|
6 |
+
# Copy requirements and install dependencies
|
7 |
+
COPY requirements.txt .
|
8 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
9 |
|
10 |
+
# Create group and non-root user for HF Spaces, then make /app writable
|
11 |
+
RUN addgroup --gid 1000 user && \
|
12 |
+
adduser --disabled-password --gecos '' --uid 1000 --gid 1000 user && \
|
13 |
+
chown -R user:user /app
|
14 |
|
15 |
+
# Copy application files
|
16 |
+
COPY . .
|
17 |
|
18 |
+
# Switch to non-root user
|
19 |
+
USER user
|
|
|
20 |
|
21 |
+
# Expose Streamlit port
|
22 |
+
EXPOSE 8501
|
23 |
|
24 |
+
# Health check for Streamlit
|
25 |
+
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
26 |
|
27 |
+
# Run Streamlit
|
28 |
+
CMD ["streamlit", "run", "frontend.py", "--server.port=8501", "--server.address=0.0.0.0"]
|
|
|
|
|
|