diff --git a/Makefile b/Makefile index b360e5b..e29bc2c 100644 --- a/Makefile +++ b/Makefile @@ -2,32 +2,25 @@ SHELL := /bin/bash # 定义变量 -REGISTRY_LOCAL ?= localhost:5000 REGISTRY ?= crpi-kbfsbvlqwt19zxum-vpc.cn-hongkong.personal.cr.aliyuncs.com/registry-yqxpro GIT_SHA := $(shell git rev-parse --short HEAD) # 定义所有需要构建的子目录 SUBDIRS = common-base develop-base universal-base -# 默认目标:按顺序构建所有子目录 all: $(SUBDIRS) -# 模式规则:每个目录目标都依赖对应的目录 -%: %/ - @echo "Building $@ Finished" - # 目录构建规则 -%/: +$(SUBDIRS): @echo "Building $@..." @pushd $@ && \ npx devcontainer build \ --platform linux/amd64,linux/arm64 \ - --image-name $(REGISTRY_LOCAL)/devcontainers/$@ --push \ - --cache-to type=registry,ref=$(REGISTRY_LOCAL)/devcontainers/$@:buildcache,mode=max \ - --cache-from type=registry,ref=$(REGISTRY_LOCAL)/devcontainers/$@:buildcache && \ - docker tag $(REGISTRY_LOCAL)/devcontainers/$@ $(REGISTRY)/devcontainers/$@:$(GIT_SHA) && \ - docker push $(REGISTRY)/devcontainers/$@:$(GIT_SHA) && \ + --image-name $(REGISTRY)/devcontainers/$@ \ + --cache-to type=local,dest=$(HOME)/docker-buildcache/devcontainers/$@,mode=max \ + --cache-from type=local,src=$(HOME)/docker-buildcache/devcontainers/$@ && \ + docker push $(REGISTRY)/devcontainers/$@ &&\ popd # 伪目标声明 -.PHONY: all parallel clean $(SUBDIRS) +.PHONY: all $(SUBDIRS)