mirror of
https://github.com/Rainyy21/k3s-health-dashboard.git
synced 2026-10-10 22:00:19 -04:00
added docker file and remove dashboard
This commit is contained in:
+32
@@ -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"]
|
||||
|
||||
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user