added docker file and remove dashboard

This commit is contained in:
Rainy21
2026-05-12 16:08:51 -04:00
parent 0cae6d64ad
commit c6c9784e09
2 changed files with 32 additions and 9 deletions
+32
View File
@@ -0,0 +1,32 @@
# ── Stage 1: deps ─────────────────────────────────────────────────────────────
FROM python:3.12-slim AS deps
COPY requirements.txt .
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
# ── Stage 2: runtime ──────────────────────────────────────────────────────────
FROM python:3.12-slim AS runtime
RUN useradd --create-home --shell /bin/bash app
WORKDIR /home/app
COPY --from=deps /install /usr/local
COPY app/ ./app/
COPY app.py .
# Streamlit writes its own config here — ensure the user owns it
RUN mkdir -p /home/app/.streamlit && chown -R app:app /home/app
USER app
EXPOSE 8501
# --server.headless=true suppresses the "want to contribute?" prompt
# --server.address=0.0.0.0 listens on all interfaces (required inside a pod)
# --server.fileWatcherType=none disables inotify — not useful in a container
CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.headless=true", "--server.fileWatcherType=none"]
-9
View File
@@ -1,6 +1,4 @@
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
from fastapi.responses import FileResponse
from app.routers import nodes, pods, metrics
app = FastAPI(title="k3s Health Dashboard")
@@ -9,13 +7,6 @@ app.include_router(nodes.router)
app.include_router(pods.router)
app.include_router(metrics.router)
app.mount("/static", StaticFiles(directory="dashboard/static"), name="static")
@app.get("/")
def serve_ui():
return FileResponse("dashboard/index.html")
@app.get("/health")
def health():