main was 16 days and 259 commits behind the line the product is actually built on, at contract 0.30.0 against 0.35.0, with no per-PC credential code at all. It was neither current nor curated - just stale. This brings it forward and, at the same time, makes it mean something: main is what a receiving site installs, and nothing else. WHAT IT CARRIES. Twelve plugins - backups, computers, endpoints, guides, knowledgebase, machines, network, notifications, printers, slides, tools, warranty - plus applications, which is manifest-less core and always ships. The only manifest dependency inside that set is endpoints on computers, and both are in it, so the closure is self-contained. WHAT IT DOES NOT. employees, geenforce, measuringtools, printedparts and usb stay on the site line. So do the Windows installer tree, the VM rehearsal helpers, the agent tooling config, one site's data loader, the internal audit and findings records, and the planner spreadsheet. 1,135 tracked files against 1,438. A REMOVAL THAT BREAKS THE APP IS NOT A REMOVAL, and two nearly shipped: deploy/site-profile-universal.json still named all seventeen plugins. It is the file docs/DEPLOY.md tells a site to provision from, so a fresh install would have failed at `flask plugin apply-profile` with PluginError - the first thing a receiving site does, broken by the branch meant to serve them. It now names the twelve that exist, and its comment says the two must agree. agent/ was never refreshed. Whoever populated this branch copied shopdb/, plugins/, frontend/ and tests/ from the site line and left the agent tree at its September state: 22 C# and PowerShell sources missing, including AgentCredentials, EnrollmentService, AgentHttpFactory and the fleet-alert client, plus one file the site line had deleted still present. The old tree is internally consistent, so it compiles, and nothing in CI builds it - every gate was green over a server that speaks enrollment and per-PC credentials to a bundled agent source that cannot. Resynced whole. DECISIONS THIS ENCODES, rather than defers: - The plugin-authoring lab builds printedparts, whose manifest depends on employees, so it could not stay. The lab remains on the site line and main ships no build-along tutorial. That is a real loss for an adopting developer and is recorded here rather than discovered later. - Recognition, Training and Recertification notifications are no longer seeded. Each splits one notification into a card per employee and renders a photo, which needs a plugin this branch does not bundle. Seeding them would offer an author a type that cannot resolve anybody. A site that installs employees gets them from that plugin's own seed. - Windows/IIS is documented as the legacy path throughout, and the README leads with Docker, because that is what a receiving site gets. The API description is regenerated for THIS branch - 347 paths and 483 operations, down from 415 and 573 - so the published contract describes what is here rather than what the site line serves. docs/CONFIG.md lost the two measuring-tool label keys the code no longer declares, which two lanes had decided opposite ways. Suite: 3124 passed, 6 skipped. Naming and style gates pass. The docs gates run rather than skip, and every index line count is derived from the file it names.
88 lines
3.6 KiB
Markdown
88 lines
3.6 KiB
Markdown
<!-- docmeta
|
|
purpose: howto
|
|
audience: adopter, developer
|
|
status: current
|
|
summary: Build the Docker image where npm cannot reach the registry, by compiling the frontend on the host first.
|
|
loadwith: none
|
|
-->
|
|
# Building the image with a pre-built frontend
|
|
|
|
> **Where this sits:** a variant of Step 2 of [DEPLOY](../DEPLOY.md), not a
|
|
> separate deployment. Everything else on that page still applies.
|
|
|
|
The shipped `Dockerfile` is a multi-stage build: stage 1 runs `npm ci` and
|
|
`npm run build` under Node, stage 2 copies the compiled SPA into the Python
|
|
image. Behind a proxy that re-signs HTTPS, stage 1 is where it dies - npm inside
|
|
the container does not trust the corporate root CA, and the failure reads
|
|
`npm ci failed` or the unhelpful `Exit handler never called`.
|
|
|
|
The fix is to build the frontend where npm already works - the host, which has
|
|
the corporate CA in its trust store - and give the image the finished
|
|
`frontend/dist/`.
|
|
|
|
It is also much faster: two to three minutes instead of fifteen. A site with no
|
|
proxy problem at all may want it for that reason alone.
|
|
|
|
## Do it
|
|
|
|
```bash
|
|
# 1. Build the frontend on the host
|
|
cd frontend
|
|
npm ci
|
|
npm run build # writes frontend/dist/
|
|
cd ..
|
|
|
|
# 2. Build and start the stack from the pre-built dist
|
|
docker compose -f docker-compose.prebuilt.yml build
|
|
docker compose -f docker-compose.prebuilt.yml up -d
|
|
```
|
|
|
|
The rest is [DEPLOY](../DEPLOY.md) unchanged: the `migrate` service runs the
|
|
schema, the plugin bootstrap and the seeders before `api` starts, nginx
|
|
terminates TLS on `API_PORT`, and the first admin comes from `/setup` or
|
|
`flask seed admin`.
|
|
|
|
## The files this uses
|
|
|
|
| File | What it is |
|
|
|---|---|
|
|
| `Dockerfile.prebuilt` | single-stage: Python dependencies plus a copy of `frontend/dist/`. No Node, no npm |
|
|
| `docker-compose.prebuilt.yml` | the same stack, building from `Dockerfile.prebuilt` |
|
|
| `.dockerignore.prebuilt` | permits `frontend/dist/` to be copied, which the normal `.dockerignore` excludes |
|
|
|
|
## What it costs
|
|
|
|
- **npm has to exist on the build host.** That is the whole trade: the trust
|
|
problem moves from the container to a machine that has already solved it.
|
|
- **It is two steps, and forgetting the first one ships a stale UI.** The image
|
|
copies whatever is in `frontend/dist/` at build time. A frontend change that
|
|
was not rebuilt is simply not in the image, and nothing warns you. If the UI
|
|
does not show your change, rebuild `dist/` before debugging anything else.
|
|
- **`frontend/dist/` has to reach the build.** Either it is committed, or the
|
|
pipeline builds it immediately before the image.
|
|
|
|
## The version of this that scales
|
|
|
|
The pre-built approach is a workaround for building at the deployment site. The
|
|
end state is not building there at all:
|
|
|
|
```yaml
|
|
# CI: build the frontend, build the image, push it
|
|
- run: cd frontend && npm ci && npm run build
|
|
- run: docker build -f Dockerfile.prebuilt -t shopdb:$GIT_SHA .
|
|
- run: docker push <registry>/shopdb:$GIT_SHA
|
|
```
|
|
|
|
A site then pulls a tagged image and runs it - seconds, no build step, no npm
|
|
anywhere near the facility. `docker-compose.pull.yml` is the compose file for
|
|
that shape today, and `docker-compose.airgap.yml` is the same idea for a site
|
|
that loads an image tarball off removable media
|
|
([DEPLOY-AIRGAP](../DEPLOY-AIRGAP.md)). Finishing that path is the distributed
|
|
release item on [ROADMAP](../ROADMAP.md).
|
|
|
|
| Approach | Build time | Behind a re-signing proxy | Where it belongs |
|
|
|---|---|---|---|
|
|
| Multi-stage `Dockerfile` | 15+ min | fails unless the CA is staged | a developer box with a clean network |
|
|
| Pre-built frontend (this page) | 2-3 min | works | a site that must build locally |
|
|
| Pull a published image | seconds | works | where every site should end up |
|