Update Dockerfile
Browse files- Dockerfile +27 -14
Dockerfile
CHANGED
|
@@ -14,24 +14,37 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
| 14 |
STREAMLIT_HOME=/tmp \
|
| 15 |
STREAMLIT_TELEMETRY_ENABLED=false
|
| 16 |
|
| 17 |
-
# Install Python deps first for
|
| 18 |
COPY requirements.txt ./requirements.txt
|
| 19 |
RUN pip install -r requirements.txt
|
| 20 |
|
| 21 |
-
# Copy
|
| 22 |
COPY . .
|
| 23 |
|
| 24 |
-
#
|
| 25 |
ENV PORT=7860
|
| 26 |
-
# Your app file is at the repo root
|
| 27 |
-
ENV APP_FILE=streamlit_app.py
|
| 28 |
|
| 29 |
-
#
|
| 30 |
-
CMD
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
--
|
| 34 |
-
--
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
STREAMLIT_HOME=/tmp \
|
| 15 |
STREAMLIT_TELEMETRY_ENABLED=false
|
| 16 |
|
| 17 |
+
# Install Python deps first for caching
|
| 18 |
COPY requirements.txt ./requirements.txt
|
| 19 |
RUN pip install -r requirements.txt
|
| 20 |
|
| 21 |
+
# Copy your repo
|
| 22 |
COPY . .
|
| 23 |
|
| 24 |
+
# HF Spaces gives $PORT; keep default for local test
|
| 25 |
ENV PORT=7860
|
|
|
|
|
|
|
| 26 |
|
| 27 |
+
# 🔎 Auto-discover the app file and start Streamlit
|
| 28 |
+
CMD bash -lc '\
|
| 29 |
+
echo "===== Application Startup ====="; \
|
| 30 |
+
echo "CWD: $(pwd)"; \
|
| 31 |
+
echo "--- top level ---"; ls -lah; \
|
| 32 |
+
echo "--- python files (depth 2) ---"; find . -maxdepth 2 -type f -name "*.py" -print; \
|
| 33 |
+
APP_FILE=""; \
|
| 34 |
+
for f in "streamlit_app.py" "src/streamlit_app.py" "app.py" "src/app.py"; do \
|
| 35 |
+
if [ -f "$f" ]; then APP_FILE="$f"; break; fi; \
|
| 36 |
+
done; \
|
| 37 |
+
if [ -z "$APP_FILE" ]; then \
|
| 38 |
+
echo "ERROR: Could not find streamlit entry file (tried streamlit_app.py, src/streamlit_app.py, app.py, src/app.py)"; \
|
| 39 |
+
exit 1; \
|
| 40 |
+
fi; \
|
| 41 |
+
echo "Starting Streamlit on $PORT using $APP_FILE"; \
|
| 42 |
+
streamlit run "$APP_FILE" \
|
| 43 |
+
--server.address 0.0.0.0 \
|
| 44 |
+
--server.port "$PORT" \
|
| 45 |
+
--server.headless true \
|
| 46 |
+
--server.enableCORS false \
|
| 47 |
+
--server.enableXsrfProtection false \
|
| 48 |
+
--browser.gatherUsageStats false \
|
| 49 |
+
--server.fileWatcherType none \
|
| 50 |
+
'
|