@@ -32,11 +32,107 @@ SHELL := /bin/bash
3232
3333.PHONY : help
3434help : # # Show this help and exit (default goal)
35+ @echo " Getting started (fresh build host):"
36+ @grep -E ' ^bootstrap:.*## ' $(MAKEFILE_LIST ) | awk ' BEGIN{FS=":.*?## "} {printf " %-26s %s\n", $$1, $$2}'
37+ @echo " "
38+ @echo " Container images (build from a clean clone):"
39+ @grep -E ' ^images[a-zA-Z0-9_-]*:.*## ' $(MAKEFILE_LIST ) | awk ' BEGIN{FS=":.*?## "} {printf " %-26s %s\n", $$1, $$2}'
40+ @echo " "
3541 @echo " Rest (Go services in rest-api/):"
36- @grep -E ' ^rest-[a-zA-Z0-9_-]+:.*## ' $(MAKEFILE_LIST ) | awk ' BEGIN{FS=":.*?## "} {printf " %-22s %s\n", $$1, $$2}'
37- @echo " rest-api/<target> Pass any target through to rest-api/Makefile"
42+ @grep -E ' ^rest-[a-zA-Z0-9_-]+:.*## ' $(MAKEFILE_LIST ) | awk ' BEGIN{FS=":.*?## "} {printf " %-26s %s\n", $$1, $$2}'
43+ @echo " rest-api/<target> Pass any target through to rest-api/Makefile"
44+ @echo " "
45+ @echo " cat rest-api/Makefile See all rest-api/ targets directly"
46+
47+ # =============================================================================
48+ # Getting started (build host setup)
49+ # =============================================================================
50+
51+ .PHONY : bootstrap
52+
53+ bootstrap : # # Set up an Ubuntu/Debian build host: apt deps, rustup, submodules, docker, cargo tooling (run once)
54+ ./scripts/setup-build-host.sh
55+
56+ # =============================================================================
57+ # Container images (single onboarding build)
58+ # =============================================================================
59+ # Build NICo container images from a clean clone. Run from the repo root on an
60+ # Ubuntu build host (see docs/manuals/building_nico_containers.md for the host
61+ # prerequisites: docker, mkosi, rust, cargo-make, ...). Every base image is
62+ # public (rust / debian / golang + nvcr.io/nvidia/distroless), so no internal
63+ # registry access is required.
64+ #
65+ # make images Build the deployable service stack: NICo Core + REST images
66+ # make images-all Build everything: the stack plus machine-validation and
67+ # boot-artifact images (needs the full mkosi build host)
68+ # make images-core NICo Core image (nico) only
69+ # make images-rest REST service images only
70+ #
71+ # Images are tagged $(IMAGE_REGISTRY)/<name>:$(IMAGE_TAG). Override IMAGE_REGISTRY
72+ # and IMAGE_TAG to build under your own registry/tag (defaults match rest-api/).
73+
74+ IMAGE_REGISTRY ?= localhost:5000
75+ IMAGE_TAG ?= latest
76+ VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
77+ CI_COMMIT_SHORT_SHA ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
78+
79+ # Intermediate base containers the Core and machine-validation images build FROM.
80+ CORE_BUILD_CONTAINER ?= nico-buildcontainer-x86_64
81+ CORE_RUNTIME_CONTAINER ?= nico-runtime-container-x86_64
82+
83+ # Target platform for the deployable images. The NICo Dockerfiles are x86_64, so
84+ # this defaults to linux/amd64; on an arm64 host (e.g. Apple Silicon) the build
85+ # runs under emulation. Override PLATFORM=linux/arm64 to build native arm64.
86+ PLATFORM ?= linux/amd64
87+
88+ .PHONY : images images-all images-base images-core images-rest \
89+ images-machine-validation images-boot-artifacts images-bfb
90+
91+ images : images-core images-rest # # Build the deployable service stack (NICo Core + REST images)
3892 @echo " "
39- @echo " cat rest-api/Makefile See all rest-api/ targets directly"
93+ @echo " Deployable images built under $( IMAGE_REGISTRY) (tag: $( IMAGE_TAG) ):"
94+ @echo " $( IMAGE_REGISTRY) /nico:$( IMAGE_TAG) (NICo Core)"
95+ @echo " $( IMAGE_REGISTRY) /nico-rest-*:$( IMAGE_TAG) (REST services)"
96+
97+ images-all : images images-machine-validation images-boot-artifacts images-bfb # # Build every image (stack + machine validation + boot artifacts; needs an mkosi build host)
98+
99+ images-base : # # Build the x86 build + runtime base containers (prerequisite for core / machine validation)
100+ docker build --platform $(PLATFORM ) --file dev/docker/Dockerfile.build-container-x86_64 -t $(CORE_BUILD_CONTAINER ) .
101+ docker build --platform $(PLATFORM ) --file dev/docker/Dockerfile.runtime-container-x86_64 -t $(CORE_RUNTIME_CONTAINER ) .
102+
103+ images-core : images-base # # Build the NICo Core image (nico)
104+ docker build --platform $(PLATFORM ) \
105+ --build-arg CONTAINER_BUILD_X86_64=$(CORE_BUILD_CONTAINER ) \
106+ --build-arg CONTAINER_RUNTIME_X86_64=$(CORE_RUNTIME_CONTAINER ) \
107+ --build-arg VERSION=$(VERSION ) \
108+ --build-arg CI_COMMIT_SHORT_SHA=$(CI_COMMIT_SHORT_SHA ) \
109+ --file dev/docker/Dockerfile.release-container-sa-x86_64 \
110+ -t $(IMAGE_REGISTRY ) /nico:$(IMAGE_TAG ) .
111+
112+ images-rest : # # Build the REST service images (api, workflow, site-manager, site-agent, db, cert-manager, flow, psm, nsm)
113+ $(MAKE ) -C rest-api docker-build IMAGE_REGISTRY=$(IMAGE_REGISTRY ) IMAGE_TAG=$(IMAGE_TAG )
114+
115+ images-machine-validation : images-base # # Build the machine-validation runner + config images
116+ docker build --platform $(PLATFORM ) --build-arg CONTAINER_RUNTIME_X86_64=$(CORE_RUNTIME_CONTAINER ) \
117+ -t machine-validation-runner:$(IMAGE_TAG ) \
118+ --file dev/docker/Dockerfile.machine-validation-runner .
119+ mkdir -p crates/machine-validation/images
120+ docker save --output crates/machine-validation/images/machine-validation-runner.tar machine-validation-runner:$(IMAGE_TAG )
121+ docker build --platform $(PLATFORM ) --build-arg CONTAINER_RUNTIME_X86_64=$(CORE_RUNTIME_CONTAINER ) \
122+ -t $(IMAGE_REGISTRY ) /machine-validation:$(IMAGE_TAG ) \
123+ --file dev/docker/Dockerfile.machine-validation-config .
124+
125+ images-boot-artifacts : # # Build the x86 boot-artifact image (requires mkosi + rust toolchain on the host)
126+ cargo make --cwd pxe --env SA_ENABLEMENT=1 build-boot-artifacts-x86-host-sa
127+ docker build --platform $(PLATFORM ) --build-arg CONTAINER_RUNTIME_X86_64=alpine:latest \
128+ -t $(IMAGE_REGISTRY ) /boot-artifacts-x86_64:$(IMAGE_TAG ) \
129+ --file dev/docker/Dockerfile.release-artifacts-x86_64 .
130+
131+ images-bfb : # # Build the aarch64 DPU BFB boot-artifact image (cross-arch; requires mkosi + aarch64 toolchain)
132+ cargo make --cwd pxe --env SA_ENABLEMENT=1 build-boot-artifacts-bfb-sa
133+ docker build --platform $(PLATFORM ) --build-arg CONTAINER_RUNTIME_AARCH64=alpine:latest \
134+ -t $(IMAGE_REGISTRY ) /boot-artifacts-aarch64:$(IMAGE_TAG ) \
135+ --file dev/docker/Dockerfile.release-artifacts-aarch64 .
40136
41137# =============================================================================
42138# Rest (delegate to rest-api/Makefile)
0 commit comments