- Switch backend runner from node:20-alpine to node:20-slim so GNU df flags (--output=pcent/avail) work inside the container - Add volume mounts to docker-compose.yml: scripts (ro), VM logs (rw), docker.sock; set VM_SCRIPTS_PATH + VM_LOG_DIR env vars - Rebuild repository.ts: env-configurable paths, cron history parser, unhealthy-container inspector, Ollama model endpoints - Add routes: GET /api/vm/cron-status, unhealthy containers, Ollama models, container restart, model unload - vm-cleanup.sh: add step_cosmos_pglog, step_docker_aged_images; fix (( count++ )) → count=$(( count + 1 )) for set -e compatibility - Add docs/VM_OBSERVABILITY_ROADMAP.md Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
58 lines
1.8 KiB
Docker
58 lines
1.8 KiB
Docker
# Build context: bytelyst-devops-tools/dashboard/ (monorepo root)
|
|
# --- Stage 1: Build ---
|
|
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app/backend
|
|
|
|
COPY backend/package.json backend/package-lock.json ./
|
|
RUN npm ci --ignore-scripts
|
|
|
|
COPY backend/tsconfig.json ./
|
|
COPY backend/src/ ./src/
|
|
|
|
# Build-time env vars (baked into the bundle)
|
|
ARG BYTELYST_COMMIT_SHA=unknown
|
|
ARG BYTELYST_COMMIT_SHA_FULL=unknown
|
|
ARG BYTELYST_BRANCH=unknown
|
|
ARG BYTELYST_BUILT_AT=unknown
|
|
ARG BYTELYST_COMMIT_AUTHOR=unknown
|
|
ARG BYTELYST_COMMIT_MESSAGE=unknown
|
|
ARG BYTELYST_DOCKER_IMAGE=devops-backend:latest
|
|
|
|
ENV BYTELYST_COMMIT_SHA=${BYTELYST_COMMIT_SHA} \
|
|
BYTELYST_COMMIT_SHA_FULL=${BYTELYST_COMMIT_SHA_FULL} \
|
|
BYTELYST_BRANCH=${BYTELYST_BRANCH} \
|
|
BYTELYST_BUILT_AT=${BYTELYST_BUILT_AT} \
|
|
BYTELYST_COMMIT_AUTHOR=${BYTELYST_COMMIT_AUTHOR} \
|
|
BYTELYST_COMMIT_MESSAGE=${BYTELYST_COMMIT_MESSAGE} \
|
|
BYTELYST_DOCKER_IMAGE=${BYTELYST_DOCKER_IMAGE}
|
|
|
|
RUN npm run build
|
|
|
|
# --- Stage 2: Run ---
|
|
# Use Debian slim (not Alpine) because vm-health-check.sh uses GNU df flags
|
|
# (--output=pcent, --output=avail) that BusyBox df does not support.
|
|
FROM node:20-slim AS runner
|
|
|
|
WORKDIR /app/backend
|
|
|
|
COPY backend/package.json backend/package-lock.json ./
|
|
RUN npm ci --omit=dev --ignore-scripts
|
|
|
|
# Install tools needed by the VM management module:
|
|
# bash — vm-health-check.sh and vm-cleanup.sh require bash
|
|
# docker.io — docker CLI to communicate with the host daemon via socket
|
|
# python3 — used in inline python3 -c snippets inside the scripts
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
curl bash docker.io python3 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY --from=builder /app/backend/dist ./dist
|
|
|
|
ENV NODE_ENV=production
|
|
ENV PORT=4004
|
|
|
|
EXPOSE 4004
|
|
|
|
CMD ["node", "dist/server.js"]
|