The image rebuilds were broken because `backend/package-lock.json` and
`web/package-lock.json` had been regenerated inside the pnpm workspace
and contained pnpm-store symlinks (e.g. `node_modules/typescript` →
`../node_modules/.pnpm/typescript@5.9.3/...` with `link: true`). When
`npm ci` ran in Docker outside the pnpm workspace, those link targets
didn't exist, so devDeps including TypeScript were silently not
installed — leaving `tsc: not found` at build time.
Fix aligns Docker builds with the declared `packageManager: pnpm@10.6.5`
field:
- Both Dockerfiles now use corepack + pnpm with the workspace
`pnpm-lock.yaml` and `--filter ... --frozen-lockfile`
- Production stage uses `pnpm deploy --prod --legacy` to carve out a
devDep-free node_modules
- Drop the stale `backend/package-lock.json` and
`web/package-lock.json` (they're regenerated wrong every time anyone
runs npm in here)
- Add `pino` + `pino-pretty` to backend deps (used by
`src/lib/logger.ts` from the Phase 5 P1 structured-logging work but
never declared)
- Fix pre-existing bug in backend runtime stage: `docker.io` package
in debian:bookworm-slim pre-creates a `docker` group at GID ~101,
so `groupadd --gid 999` then `useradd --gid 999` failed. Use
`groupmod` when the group already exists.
After this commit:
- 87/87 tests pass (74 backend + 13 web)
- typecheck clean
- lint: 0 errors (only pre-existing unused-var warnings)
- `docker compose build && up` succeeds end-to-end
- Tailscale URL serves the new dashboard with all Phase 1-7 work live
- CORS allow-list driven by `EXTRA_CORS_ORIGINS` env var (no hot-patch
needed in the running container)
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
77 lines
2.5 KiB
Docker
77 lines
2.5 KiB
Docker
# Build context: bytelyst-devops-tools/dashboard/ (monorepo root)
|
|
#
|
|
# Uses pnpm (matches `packageManager` field) and the workspace
|
|
# `pnpm-lock.yaml`. See backend/Dockerfile for the full background on
|
|
# why the previous `npm ci` based build was broken (pnpm-store symlinks
|
|
# leaking into the npm lockfile).
|
|
|
|
# --- Stage 1: Build ---
|
|
FROM node:20-alpine AS builder
|
|
|
|
ENV BYTELYST_PACKAGE_SOURCE=gitea
|
|
RUN corepack enable && corepack prepare pnpm@10.6.5 --activate
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .pnpmfile.cjs ./
|
|
COPY web/package.json ./web/
|
|
|
|
RUN pnpm install --frozen-lockfile --filter "@bytelyst/devops-web..." --ignore-scripts
|
|
|
|
COPY web/tsconfig.json ./web/
|
|
COPY web/next-env.d.ts ./web/
|
|
COPY web/next.config.js ./web/
|
|
COPY web/tailwind.config.ts ./web/
|
|
COPY web/postcss.config.js ./web/
|
|
COPY web/src/ ./web/src/
|
|
COPY web/public/ ./web/public/
|
|
|
|
# Build-time env vars (baked into the static bundle)
|
|
ARG NEXT_PUBLIC_PRODUCT_ID=devops
|
|
ARG NEXT_PUBLIC_PLATFORM_URL=https://api.bytelyst.com/platform/api
|
|
ARG NEXT_PUBLIC_DEVOPS_API_URL=https://api.bytelyst.com/devops
|
|
|
|
# Build metadata for @bytelyst/devops (web 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-web:latest
|
|
|
|
ENV NEXT_PUBLIC_PRODUCT_ID=${NEXT_PUBLIC_PRODUCT_ID} \
|
|
NEXT_PUBLIC_PLATFORM_URL=${NEXT_PUBLIC_PLATFORM_URL} \
|
|
NEXT_PUBLIC_DEVOPS_API_URL=${NEXT_PUBLIC_DEVOPS_API_URL} \
|
|
NEXT_PUBLIC_BYTELYST_COMMIT_SHA=${BYTELYST_COMMIT_SHA} \
|
|
NEXT_PUBLIC_BYTELYST_COMMIT_SHA_FULL=${BYTELYST_COMMIT_SHA_FULL} \
|
|
NEXT_PUBLIC_BYTELYST_BRANCH=${BYTELYST_BRANCH} \
|
|
NEXT_PUBLIC_BYTELYST_BUILT_AT=${BYTELYST_BUILT_AT} \
|
|
NEXT_PUBLIC_BYTELYST_COMMIT_AUTHOR=${BYTELYST_COMMIT_AUTHOR} \
|
|
NEXT_PUBLIC_BYTELYST_COMMIT_MESSAGE=${BYTELYST_COMMIT_MESSAGE} \
|
|
NEXT_PUBLIC_BYTELYST_DOCKER_IMAGE=${BYTELYST_DOCKER_IMAGE}
|
|
|
|
WORKDIR /app/web
|
|
RUN pnpm run build
|
|
|
|
# Carve out a production-only deploy bundle.
|
|
WORKDIR /app
|
|
RUN pnpm --filter "@bytelyst/devops-web" deploy --prod --legacy /deploy
|
|
|
|
# --- Stage 2: Serve ---
|
|
FROM node:20-alpine AS runner
|
|
|
|
WORKDIR /app/web
|
|
|
|
COPY --from=builder /deploy/package.json ./package.json
|
|
COPY --from=builder /deploy/node_modules ./node_modules
|
|
COPY --from=builder /app/web/.next ./.next
|
|
COPY --from=builder /app/web/public ./public
|
|
|
|
ENV NODE_ENV=production
|
|
ENV PORT=3000
|
|
|
|
EXPOSE 3000
|
|
|
|
CMD ["npm", "run", "start"]
|