添加构建脚本
This commit is contained in:
27
Makefile
Normal file
27
Makefile
Normal file
@@ -0,0 +1,27 @@
|
||||
# 定义变量
|
||||
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)
|
||||
|
||||
# 定义所有需要构建的子目录
|
||||
SUBDIRS = common-base develop-base universal-base
|
||||
|
||||
# 默认目标:按顺序构建所有子目录
|
||||
all: $(SUBDIRS)
|
||||
|
||||
# 定义每个子目录的构建规则
|
||||
$(SUBDIRS):
|
||||
@echo "Building $@..."
|
||||
@pushd $@ && \
|
||||
npx devcontainer build \
|
||||
--platform linux/amd64,linux/arm64 \
|
||||
--image-name devcontainers/$@ \
|
||||
--cache-to type=registry,ref=$(REGISTRY)/devcontainers-$@:buildcache,mode=max \
|
||||
--cache-from type=registry,ref=$(REGISTRY)/devcontainers-$@:buildcache && \
|
||||
docker tag devcontainers/$@ $(REGISTRY_MARK)/devcontainers/$@ && \
|
||||
docker tag devcontainers/$@ $(REGISTRY)/devcontainers-$@:$(GIT_SHA) && \
|
||||
docker push $(REGISTRY)/devcontainers-$@:$(GIT_SHA) && \
|
||||
popd
|
||||
|
||||
# 伪目标声明
|
||||
.PHONY: all parallel clean $(SUBDIRS)
|
||||
17
system-setup.sh
Normal file
17
system-setup.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
export REGISTRY_USERNAME=qxyang686@qq.com
|
||||
export REGISTRY_PASSWORD=
|
||||
export REGISTRY_HOST=crpi-kbfsbvlqwt19zxum-vpc.cn-hongkong.personal.cr.aliyuncs.com
|
||||
export REGISTRY=crpi-kbfsbvlqwt19zxum-vpc.cn-hongkong.personal.cr.aliyuncs.com/registry-yqxpro
|
||||
|
||||
sudo apt update
|
||||
sudo apt install -y npm git
|
||||
curl -fsSL https://raw.githubusercontent.com/docker/docker-install/master/install.sh | sh
|
||||
sudo usermod -aG docker $USER
|
||||
docker buildx create --use --name multiarch-builder
|
||||
docker login --username=$REGISTRY_USERNAME --password=$REGISTRY_PASSWORD $REGISTRY_HOST
|
||||
|
||||
git clone https://gitea.yqxpro.com/QXYang686/devcontainers.git
|
||||
cd devcontainers
|
||||
npm install
|
||||
Reference in New Issue
Block a user