Compare commits
1 Commits
223242e7aa
...
d92ca7a5be
| Author | SHA1 | Date | |
|---|---|---|---|
| d92ca7a5be |
21
Makefile
21
Makefile
@@ -2,7 +2,7 @@
|
||||
SHELL := /bin/bash
|
||||
|
||||
# 定义变量
|
||||
REGISTRY_LOCAL ?= localhost:5000
|
||||
REGISTRY_MARK ?= registry.yqxpro.com
|
||||
REGISTRY ?= crpi-kbfsbvlqwt19zxum-vpc.cn-hongkong.personal.cr.aliyuncs.com/registry-yqxpro
|
||||
GIT_SHA := $(shell git rev-parse --short HEAD)
|
||||
|
||||
@@ -12,21 +12,18 @@ 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 devcontainers/$@ \
|
||||
--cache-to type=local,dest=$(HOME)/docker-buildcache/devcontainers-$@,mode=max \
|
||||
--cache-from type=local,src=$(HOME)/docker-buildcache/devcontainers-$@ && \
|
||||
docker tag devcontainers/$@ $(REGISTRY_MARK)/devcontainers/$@ && \
|
||||
docker tag devcontainers/$@ $(REGISTRY)/devcontainers-$@:$(GIT_SHA) && \
|
||||
docker push $(REGISTRY)/devcontainers-$@:$(GIT_SHA) && \
|
||||
popd
|
||||
|
||||
# 伪目标声明
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM localhost:5000/devcontainers/common-base
|
||||
FROM regsitry.yqxpro.com/devcontainers/common-base
|
||||
|
||||
# Mount for docker-in-docker
|
||||
VOLUME [ "/var/lib/docker" ]
|
||||
|
||||
@@ -12,11 +12,6 @@ sudo usermod -aG docker $USER
|
||||
docker buildx create --use --name multiarch-builder
|
||||
docker login --username=$REGISTRY_USERNAME --password=$REGISTRY_PASSWORD $REGISTRY_HOST
|
||||
|
||||
docker run -d \
|
||||
-p 5000:5000 \
|
||||
--name registry \
|
||||
registry:3
|
||||
|
||||
git clone https://gitea.yqxpro.com/QXYang686/devcontainers.git
|
||||
cd devcontainers
|
||||
npm install
|
||||
|
||||
@@ -1 +1 @@
|
||||
FROM localhost:5000/devcontainers/develop-base
|
||||
FROM regsitry.yqxpro.com/devcontainers/develop-base
|
||||
|
||||
Reference in New Issue
Block a user