phi2 / Dockerfile
Amey9766's picture
Update Dockerfile
bb24471 verified
Raw
History Blame Contribute Delete
1.51 kB
FROM python:3.13-slim
WORKDIR /workspace
# Minimal system deps
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential curl git && \
rm -rf /var/lib/apt/lists/*
# Python/Streamlit env
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
STREAMLIT_HOME=/tmp \
STREAMLIT_TELEMETRY_ENABLED=false
# Install Python deps first for caching
COPY requirements.txt ./requirements.txt
RUN pip install -r requirements.txt
# Copy your repo
COPY . .
# HF Spaces gives $PORT; keep default for local test
ENV PORT=7860
# ๐Ÿ”Ž Auto-discover the app file and start Streamlit
CMD bash -lc '\
echo "===== Application Startup ====="; \
echo "CWD: $(pwd)"; \
echo "--- top level ---"; ls -lah; \
echo "--- python files (depth 2) ---"; find . -maxdepth 2 -type f -name "*.py" -print; \
APP_FILE=""; \
for f in "streamlit_app.py" "src/streamlit_app.py" "app.py" "src/app.py"; do \
if [ -f "$f" ]; then APP_FILE="$f"; break; fi; \
done; \
if [ -z "$APP_FILE" ]; then \
echo "ERROR: Could not find streamlit entry file (tried streamlit_app.py, src/streamlit_app.py, app.py, src/app.py)"; \
exit 1; \
fi; \
echo "Starting Streamlit on $PORT using $APP_FILE"; \
streamlit run "$APP_FILE" \
--server.address 0.0.0.0 \
--server.port "$PORT" \
--server.headless true \
--server.enableCORS false \
--server.enableXsrfProtection false \
--browser.gatherUsageStats false \
--server.fileWatcherType none \
'