chore: enable multi-architecture build and push in .cnb.yml and update bt.sh timestamp format

This commit is contained in:
xiao 2025-01-07 16:11:44 +08:00
parent 9d521d4403
commit de7ec85ab4
2 changed files with 70 additions and 70 deletions

138
.cnb.yml
View File

@ -6,77 +6,77 @@ $:
build:
dockerfile: .ide/Dockerfile
push:
# - runner:
# tags: cnb:arch:amd64
# services:
# - docker
# imports: https://cnb.cool/btpanel/secret/-/blob/main/docker.yml
# env:
# IMAGE_TAG: btpanel/baota:9.0_lts_fresh-linux-amd64
# stages:
# - name: docker login
# script: docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWD"
# - name: docker build
# script: docker build -t ${IMAGE_TAG} .
# - name: docker push
# script: docker push ${IMAGE_TAG}
# - name: resolve
# type: cnb:resolve
# options:
# key: build-amd64
- runner:
tags: cnb:arch:amd64
services:
- docker
imports: https://cnb.cool/btpanel/secret/-/blob/main/docker.yml
env:
IMAGE_TAG: btpanel/baota:9.0_lts_fresh-linux-amd64
stages:
- name: docker login
script: docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWD"
- name: docker build
script: docker build -t ${IMAGE_TAG} .
- name: docker push
script: docker push ${IMAGE_TAG}
- name: resolve
type: cnb:resolve
options:
key: build-amd64
# - runner:
# tags: cnb:arch:arm64:v8
# services:
# - docker
# imports: https://cnb.cool/btpanel/secret/-/blob/main/docker.yml
# env:
# IMAGE_TAG: btpanel/baota:9.0_lts_fresh-linux-arm64
# stages:
# - name: docker login
# script: docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWD"
# - name: docker build
# script: docker build -t ${IMAGE_TAG} .
# - name: docker push
# script: docker push ${IMAGE_TAG}
# - name: resolve
# type: cnb:resolve
# options:
# key: build-arm64
- runner:
tags: cnb:arch:arm64:v8
services:
- docker
imports: https://cnb.cool/btpanel/secret/-/blob/main/docker.yml
env:
IMAGE_TAG: btpanel/baota:9.0_lts_fresh-linux-arm64
stages:
- name: docker login
script: docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWD"
- name: docker build
script: docker build -t ${IMAGE_TAG} .
- name: docker push
script: docker push ${IMAGE_TAG}
- name: resolve
type: cnb:resolve
options:
key: build-arm64
# - services:
# - docker
# imports: https://cnb.cool/btpanel/secret/-/blob/main/docker.yml
# env:
# IMAGE_TAG: btpanel/baota:9.0_lts_fresh
# stages:
# - name: await the amd64
# type: cnb:await
# options:
# key: build-amd64
# - name: await the arm64
# type: cnb:await
# options:
# key: build-arm64
# - name: manifest
# image: cnbcool/manifest
# settings:
# username: $DOCKER_USERNAME
# password: $DOCKER_PASSWD
# target: ${IMAGE_TAG}
# template: ${IMAGE_TAG}-OS-ARCH
# platforms:
# - linux/amd64
# - linux/arm64
# - name: clear
# image: lumir/remove-dockerhub-tag
# args:
# - --user
# - $DOCKER_USERNAME
# - --password
# - $DOCKER_PASSWD
# - ${IMAGE_TAG}-linux-amd64
# - ${IMAGE_TAG}-linux-arm64
- services:
- docker
imports: https://cnb.cool/btpanel/secret/-/blob/main/docker.yml
env:
IMAGE_TAG: btpanel/baota:9.0_lts_fresh
stages:
- name: await the amd64
type: cnb:await
options:
key: build-amd64
- name: await the arm64
type: cnb:await
options:
key: build-arm64
- name: manifest
image: cnbcool/manifest
settings:
username: $DOCKER_USERNAME
password: $DOCKER_PASSWD
target: ${IMAGE_TAG}
template: ${IMAGE_TAG}-OS-ARCH
platforms:
- linux/amd64
- linux/arm64
- name: clear
image: lumir/remove-dockerhub-tag
args:
- --user
- $DOCKER_USERNAME
- --password
- $DOCKER_PASSWD
- ${IMAGE_TAG}-linux-amd64
- ${IMAGE_TAG}-linux-arm64
- runner:
tags: cnb:arch:amd64

2
bt.sh
View File

@ -11,7 +11,7 @@ O_pl=$(cat /www/server/panel/data/o.pl)
backup_database() {
if [ -d "${Data_Path}" ] && [ ! -z "$(ls -A ${Data_Path})" ]; then
if [ ! -d "${Setup_Path}" ] || [ -z "$(ls -A ${Setup_Path})" ]; then
timestamp=$(date +"%Y%m%d%H%M%S")
timestamp=$(date +"%s")
tar czf /www/server/data_backup_$timestamp.tar.gz -C ${Data_Path} .
fi
fi