Adds a small Next.js dashboard as a new Docker service () that replaces the need to manually edit and call over SSH every time you want to tweak llama launch parameters. Features: - Live status panel for all GPU-node containers (auto-refresh) - Models list with file sizes, click-to-select active model - Structured launch config form: * Model, ctx-size, parallel, batch-size, n-gpu-layers, threads * Context overflow (none / shift / evict) * Speculative decoding (spec-type, draft model, spec-draft-n-max) * Free-form extra args textarea for anything else - Named presets (save / load / delete) - Start / Restart / Stop / Remove llama actions - Live streaming logs viewer (docker logs -f) - GPU status (nvidia-smi via docker exec on llama) - Auto-writes LLAMA_MODEL and LLAMA_EXTRA_ARGS back to .env so the existing workflow keeps working, and persists full structured config to gpu/dashboard/config.json for reload on next visit Integration: - New service in compose.yaml (no profile, runs always) - Mounts /var/run/docker.sock + HOST_PROJECT_PATH - Tailscale serve exposes port 8090 -> dashboard:3000 - build.sh extended to build the dashboard image Tech: Next.js 16 standalone, React 19, TypeScript 5, Tailwind 4, shadcn-style components, Radix UI primitives.
69 lines
1.8 KiB
Docker
69 lines
1.8 KiB
Docker
# syntax=docker/dockerfile:1.7
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Stage 1: Install deps & build Next.js standalone output
|
|
# ---------------------------------------------------------------------------
|
|
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Install dependencies (use yarn or npm — package-lock.json optional)
|
|
COPY package.json ./
|
|
COPY package-lock.json* ./
|
|
COPY yarn.lock* ./
|
|
|
|
RUN if [ -f yarn.lock ]; then \
|
|
yarn install --frozen-lockfile; \
|
|
elif [ -f package-lock.json ]; then \
|
|
npm ci; \
|
|
else \
|
|
npm install; \
|
|
fi
|
|
|
|
# Copy sources and build
|
|
COPY tsconfig.json next.config.ts next-env.d.ts postcss.config.mjs .eslintrc.json ./
|
|
COPY src ./src
|
|
COPY public ./public
|
|
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
|
|
RUN if [ -f yarn.lock ]; then \
|
|
yarn build; \
|
|
else \
|
|
npm run build; \
|
|
fi
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# Stage 2: Runtime — Alpine + Node + docker-cli + docker compose plugin
|
|
# ---------------------------------------------------------------------------
|
|
FROM node:20-alpine AS runtime
|
|
|
|
# docker-cli + compose plugin + tini for proper signal handling
|
|
RUN apk add --no-cache \
|
|
docker \
|
|
docker-cli-compose \
|
|
tini \
|
|
ca-certificates \
|
|
wget \
|
|
&& addgroup -g 1001 dash \
|
|
&& adduser -D -G dash -u 1001 dash
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy standalone Next.js build output
|
|
COPY --from=builder --chown=dash:dash /app/.next/standalone ./
|
|
COPY --from=builder --chown=dash:dash /app/.next/static ./.next/static
|
|
COPY --from=builder --chown=dash:dash /app/public ./public
|
|
|
|
USER dash
|
|
|
|
ENV NODE_ENV=production
|
|
ENV PORT=3000
|
|
ENV HOSTNAME=0.0.0.0
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
|
|
EXPOSE 3000
|
|
|
|
ENTRYPOINT ["/sbin/tini", "--"]
|
|
CMD ["node", "server.js"]
|