Spaces:
Running
Running
Upload Dockerfile
Browse files- Dockerfile +19 -14
Dockerfile
CHANGED
@@ -1,23 +1,28 @@
|
|
|
|
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 non-root user for HF Spaces and make /app writable
|
11 |
-
RUN adduser --disabled-password --gecos '' --uid 1000 --gid 1000 user && chown -R user:user /app
|
12 |
|
13 |
-
#
|
14 |
-
|
15 |
|
16 |
-
#
|
17 |
-
|
|
|
18 |
|
19 |
-
#
|
20 |
-
|
21 |
|
22 |
-
#
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
# (Optional) system deps if you need them; safe to remove if not needed
|
12 |
+
RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*
|
13 |
|
14 |
+
# Install Python deps
|
15 |
+
COPY requirements.txt /app/
|
16 |
+
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
|
17 |
|
18 |
+
# Copy code
|
19 |
+
COPY . /app
|
20 |
|
21 |
+
# Do NOT set STREAMLIT_SERVER_PORT here.
|
22 |
+
# Spaces will inject $PORT at runtime.
|
23 |
+
|
24 |
+
|
25 |
+
# Start Streamlit on the port Spaces provides, and bind to 0.0.0.0
|
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"]
|