From 1625989c4891a34e16c6869f534ccd2c9c83ce04 Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Mon, 29 Dec 2025 22:54:19 +0800 Subject: [PATCH] chore: build-node-base-image --- .github/workflows/base-image-build.yml | 56 ++++++++++++++++++++++++++ scripts/build/Dockerfile | 8 ++++ scripts/build/docker-compose.yaml | 8 ++++ 3 files changed, 72 insertions(+) create mode 100644 .github/workflows/base-image-build.yml create mode 100644 scripts/build/Dockerfile create mode 100644 scripts/build/docker-compose.yaml diff --git a/.github/workflows/base-image-build.yml b/.github/workflows/base-image-build.yml new file mode 100644 index 000000000..161e5a9da --- /dev/null +++ b/.github/workflows/base-image-build.yml @@ -0,0 +1,56 @@ +name: build-node-base-image +on: + push: + branches: ['v2-dev'] + paths: + - "scripts/build/Dockerfile" +# workflow_run: +# workflows: [ "deploy-demo" ] +# types: +# - completed + +# schedule: +# - # 国际时间 19:17 执行,北京时间3:17 ↙↙↙ 改成你想要每天自动执行的时间 +# - cron: '17 19 * * *' +permissions: + contents: read + packages: write + +jobs: + build-node-base-image: + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + lfs: true + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.dockerhub_username }} + password: ${{ secrets.dockerhub_password }} + + - name: Build default platforms + uses: docker/build-push-action@v6 + with: + platforms: linux/amd64,linux/arm64 + push: true + context: ./scripts/build/ + tags: | + greper/node-base:22-alpine-1 + - name: Build armv7 + uses: docker/build-push-action@v6 + with: + platforms: linux/arm/v7 + push: true + context: ./scripts/build/ + tags: | + greper/node-base:22-alpine-1-armv7 diff --git a/scripts/build/Dockerfile b/scripts/build/Dockerfile new file mode 100644 index 000000000..014300165 --- /dev/null +++ b/scripts/build/Dockerfile @@ -0,0 +1,8 @@ +FROM node:22-alpine AS builder + +RUN apk add build-base +RUN wget -O - https://github.com/jemalloc/jemalloc/releases/download/5.3.0/jemalloc-5.3.0.tar.bz2 | tar -xj && \ + cd jemalloc-5.3.0 && \ + ./configure && \ + make && \ + make install \ No newline at end of file diff --git a/scripts/build/docker-compose.yaml b/scripts/build/docker-compose.yaml new file mode 100644 index 000000000..537badd6e --- /dev/null +++ b/scripts/build/docker-compose.yaml @@ -0,0 +1,8 @@ +version: '3.3' # 指定docker-compose 版本 +services: # 要拉起的服务们 + node-base: + build: + context: ./ + dockerfile: Dockerfile + image: greper/node-base:22-alpine-1 +