Files
docker-builder/Makefile
Martin Kennedy b056beb2f8 Rework the builder targets so we may use different remotes
Now, in order to set up the builder at a given remote @ commit , we
will want to make

     ${docker_src}/built/openwrt-builder-remote_commit.sentinel

... and then use the openwrt-builder-remote_commit image as a base.

New remotes can / should be added to openwrt-remotes.txt. Honestly
this oughta have been under the openwrt dir but, eh.
2021-02-15 16:29:00 +00:00

34 lines
1.1 KiB
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' $< | 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 \
${docker_src}/openwrt-remotes.txt
cd ${docker_src}; \
rev=$*; \
if [ "$rev" != "$${rev%_*}" ]; then \
remote=$(shell echo $* | cut -d_ -f1); \
commit=$(shell echo $* | cut -d_ -f2); \
remoteurl=$(shell echo $* | cut -d_ -f1 | xargs -I{} grep -e "^{}" ${docker_src}/openwrt-remotes.txt | cut -d ' ' -f2); \
docker build -f $< --build-arg=remote="$$remote" --build-arg=commit="$$commit" --build-arg=remoteurl="$$remoteurl" --tag openwrt-builder-$* .; \
else \
commit=$(shell echo $*); \
docker build -f $< --build-arg=commit="$$commit" --tag openwrt-builder-$* . ; \
fi; \
touch $@;