From 69591ec230aa869e78ceba47e02fe4885e98042e Mon Sep 17 00:00:00 2001 From: thuanle Date: Tue, 28 Apr 2026 00:11:02 +0700 Subject: [PATCH] ci --- .gitea/workflows/node-go.yml | 66 ++++++++++++++++++++++++++++++++++++ README.md | 3 +- 2 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 .gitea/workflows/node-go.yml diff --git a/.gitea/workflows/node-go.yml b/.gitea/workflows/node-go.yml new file mode 100644 index 0000000..a0c4f50 --- /dev/null +++ b/.gitea/workflows/node-go.yml @@ -0,0 +1,66 @@ +name: node-go image + +on: + push: + schedule: + - cron: '0 2 * * 0' # 02:00 sáng Chủ nhật (UTC) + workflow_dispatch: + +env: + IMAGE_REPO: git.thuanle.me/public/node-go + IMAGE: node-go + +jobs: + build: + strategy: + matrix: + arch: + - arm64 + - amd64 + runs-on: ${{ matrix.arch }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Login to Docker Registry + uses: docker/login-action@v3 + with: + registry: git.thuanle.me + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build Docker images + run: | + echo "Building image ${{ env.IMAGE }} for architecture: ${{ matrix.arch }}" + + docker build \ + -f ${{ env.IMAGE }}.Dockerfile \ + -t ${{ env.IMAGE_REPO }}:${{ matrix.arch }}-latest \ + --label "build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \ + --label "commit_sha=${{ github.sha }}" \ + . + + docker push ${{ env.IMAGE_REPO }}:${{ matrix.arch }}-latest + + amend-manifest: + runs-on: linux + needs: [build] + steps: + - name: Login to Docker Registry + uses: docker/login-action@v3 + with: + registry: git.thuanle.me + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Push Docker manifest + run: | + echo "Delete existing manifest" + docker manifest rm ${{ env.IMAGE_REPO }}:latest || true + + echo "Create new manifest" + docker manifest create ${{ env.IMAGE_REPO }}:latest \ + ${{ env.IMAGE_REPO }}:amd64-latest \ + ${{ env.IMAGE_REPO }}:arm64-latest + + docker manifest push ${{ env.IMAGE_REPO }}:latest diff --git a/README.md b/README.md index 1f80b2a..b85c74b 100644 --- a/README.md +++ b/README.md @@ -21,8 +21,9 @@ Kho lưu trữ này cung cấp các Docker base image cho nhiều mục đích s - **python v3.11** - **node-go** - - `git.thuanle.me/public/base:node-go-latest` + - `git.thuanle.me/public/node-go:latest` - Dockerfile: [node-go.Dockerfile](node-go.Dockerfile) + - Workflow: [.gitea/workflows/node-go.yml](.gitea/workflows/node-go.yml) - Các gói/phần mềm đã cài đặt: - **Node.js** kèm theo **npm** và **yarn** - **git**