docker-builder/Makefile
Martin Kennedy fe8eae25e9 openwrt-builder-commit: For commit-specific OpenWrt builds
Now we can set up an OpenWrt builder as we want -- just run

    make built/openwrt-builder-${commit}.sentinel

and then

    docker run ${args} openwrt-builder-${commit} ${CMD}

This will won't need to pull down everything from scratch: the image
is already cached and has everything it needs to compile.

As for what ${args} would need to be for this to work:

- You need to mount a +x build system prep script to /input.sh

- You need to mount a +x build system output extractor to /output.sh

- You need to mount a folder with input resources to /input

- You need to mount an output folder to /output

So, /input.sh could `cp /input/diffconfig /builder/openwrt/.config`,
then cd to /builder/openwrt and run `make defconfig`. The ${CMD} could
then actually build, and /output.sh could collect logs and build
artefacts to /output.

But each of those build system setups can be disincluded from the
main build-system setup per-commit. We no longer have to repeatedly
setup the entire build system just to keep build environments for
different boards separate: only the things that are different between
build trees need that to be done.

Oh, and no more builds spoiled by stale artefacts :D
2021-02-08 15:11:41 +00:00

23 lines
670 B
Makefile

define INC_DOCKER =
1
endef
$(info Defined INC_DOCKER)
include /devel/docker/docker_vars.sh
export
${docker_src}/built/%.sentinel: ${docker_src}/%.dockerfile
grep -e '^FROM' "$*".dockerfile | awk '{print $$2}' \
| tr : _ | xargs -I{} $(MAKE) ${docker_src}/built/{}.sentinel;
cd ${docker_src}; docker build -f $< --tag $* .;
touch $@;
${docker_src}/built/debian_10.sentinel:
docker pull "debian:10" && touch $@;
${docker_src}/built/openwrt-builder-%.sentinel: \
${docker_src}/openwrt-builder-commit.dockerfile \
${docker_src}/built/openwrt-builder.sentinel
cd ${docker_src}; docker build -f $< --build-arg=commit=$* --tag openwrt-builder-$* .; \
touch $@;