Spaces:
Sleeping
Sleeping
Upload 8 files
Browse files- Dockerfile +10 -20
- frontend.py +1 -1
Dockerfile
CHANGED
@@ -1,30 +1,20 @@
|
|
1 |
-
#
|
2 |
FROM python:3.10-slim
|
3 |
|
4 |
-
ENV PYTHONUNBUFFERED=1 \
|
5 |
-
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
6 |
-
PORT=7860
|
7 |
-
|
8 |
-
# -------- system deps (curl for healthcheck)
|
9 |
-
RUN apt-get update && apt-get install -y --no-install-recommends \
|
10 |
-
curl \
|
11 |
-
&& rm -rf /var/lib/apt/lists/*
|
12 |
-
|
13 |
-
# -------- workdir
|
14 |
WORKDIR /app
|
15 |
|
16 |
-
#
|
|
|
|
|
|
|
17 |
COPY requirements.txt /app/
|
18 |
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
|
19 |
|
20 |
-
#
|
21 |
-
# (Put ALL your python files in the image)
|
22 |
COPY . /app
|
23 |
|
24 |
-
#
|
25 |
-
#
|
26 |
-
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=5 \
|
27 |
-
CMD curl --fail http://127.0.0.1:${PORT}/ || exit 1
|
28 |
|
29 |
-
# Streamlit
|
30 |
-
CMD ["
|
|
|
1 |
+
# Dockerfile
|
2 |
FROM python:3.10-slim
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
WORKDIR /app
|
5 |
|
6 |
+
# (Optional) system deps if you need them; safe to remove if not needed
|
7 |
+
RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*
|
8 |
+
|
9 |
+
# Install Python deps
|
10 |
COPY requirements.txt /app/
|
11 |
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
|
12 |
|
13 |
+
# Copy code
|
|
|
14 |
COPY . /app
|
15 |
|
16 |
+
# Do NOT set STREAMLIT_SERVER_PORT here.
|
17 |
+
# Spaces will inject $PORT at runtime.
|
|
|
|
|
18 |
|
19 |
+
# Start Streamlit on the port Spaces provides, and bind to 0.0.0.0
|
20 |
+
CMD ["bash", "-lc", "streamlit run /app/frontend.py --server.port $PORT --server.address 0.0.0.0"]
|
frontend.py
CHANGED
@@ -117,7 +117,7 @@ async def initialize_agent():
|
|
117 |
return True
|
118 |
except Exception as e:
|
119 |
st.error(f"Failed to initialize agent: {str(e)}")
|
120 |
-
st.info("Please make sure the stock server is running: `python
|
121 |
return False
|
122 |
return True
|
123 |
|
|
|
117 |
return True
|
118 |
except Exception as e:
|
119 |
st.error(f"Failed to initialize agent: {str(e)}")
|
120 |
+
st.info("Please make sure the stock server is running: `python stock_server.py`")
|
121 |
return False
|
122 |
return True
|
123 |
|