Spaces:
Runtime error
Runtime error
File size: 3,363 Bytes
3c670d5 1580fbc 3c670d5 1a85bd6 3c670d5 1580fbc 3c670d5 1580fbc 3c670d5 1580fbc 0a1f9c3 1580fbc 537d660 1580fbc 3c670d5 1580fbc f4a81bc 0a1f9c3 f4a81bc 40742ab f4a81bc 40742ab f4a81bc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# ─── Base Image ───────────────────────────────────────────────
FROM python:3.11-slim
# ─── System Setup ─────────────────────────────────────────────
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential git curl && \
rm -rf /var/lib/apt/lists/*
# ─── Non-root User ────────────────────────────────────────────
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
# ─── Workdir ─────────────────────────────────────────────────
WORKDIR /app
# ─── Install Requirements ────────────────────────────────────
COPY --chown=user requirements.txt requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# ─── Copy Project and Install Package ─────────────────────────
COPY --chown=user . /app
RUN pip install -e .
# ─── Expose Ports ────────────────────────────────────────────
# Streamlit default = 7860
# Gradio default = 7860
# Chainlit default = 8000
EXPOSE 7860 8000
# ─── Environment Variable to Pick Framework ───────────────────
ENV APP_MODE=streamlit
# ─── Entrypoint ───────────────────────────────────────────────
# Detect whether app.py is at /app/app.py or /app/omniscientframework/app.py
CMD MODE=$(cat .app_mode 2>/dev/null || echo "$APP_MODE") && \
if [ "$MODE" = "streamlit" ]; then \
if [ -f "app.py" ]; then \
echo "🚀 Launching Streamlit (root-level app.py)"; \
streamlit run app.py --server.port=7860 --server.address=0.0.0.0; \
elif [ -f "omniscientframework/app.py" ]; then \
echo "🚀 Launching Streamlit (package-level app.py)"; \
streamlit run omniscientframework/app.py --server.port=7860 --server.address=0.0.0.0; \
else \
echo "❌ Error: app.py not found."; exit 1; \
fi; \
elif [ "$MODE" = "gradio" ]; then \
if [ -f "gradio_app.py" ]; then \
python gradio_app.py; \
elif [ -f "omniscientframework/gradio_app.py" ]; then \
python omniscientframework/gradio_app.py; \
else \
echo "❌ Error: gradio_app.py not found."; exit 1; \
fi; \
elif [ "$MODE" = "chainlit" ]; then \
if [ -f "chainlit_app.py" ]; then \
chainlit run chainlit_app.py --host 0.0.0.0 --port 8000; \
elif [ -f "omniscientframework/chainlit_app.py" ]; then \
chainlit run omniscientframework/chainlit_app.py --host 0.0.0.0 --port 8000; \
else \
echo "❌ Error: chainlit_app.py not found."; exit 1; \
fi; \
else \
echo "❌ Unknown APP_MODE: $MODE" && exit 1; \
fi
|