diff --git a/.github/workflows/build&push.yaml b/.github/workflows/build&push.yaml index 25bfcc40..bc05ea66 100644 --- a/.github/workflows/build&push.yaml +++ b/.github/workflows/build&push.yaml @@ -1,8 +1,3 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - name: Publish Docker image on: @@ -18,33 +13,33 @@ jobs: - name: Extract Version id: version_step run: | - echo "##[set-output name=version;]NACOS_VERSION=${GITHUB_REF#$"refs/tags/v"}" + echo "version=NACOS_VERSION=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT" - name: Check out the repo - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 1 - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v3 - name: Log in to Docker Hub - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@v3 + uses: docker/metadata-action@v5 with: images: nacos/nacos-server - name: Build and push Docker image - uses: docker/build-push-action@v2.3.0 + uses: docker/build-push-action@v6 with: context: build platforms: linux/amd64,linux/arm64 @@ -52,7 +47,7 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - build-args: ${{steps.version_step.outputs.version}} + build-args: ${{ steps.version_step.outputs.version }} push_to_multi_platforms_registry: name: Push Docker slim image to Docker Hub @@ -61,28 +56,28 @@ jobs: - name: Extract Version id: version_step run: | - echo "##[set-output name=version;]NACOS_VERSION=${GITHUB_REF#$"refs/tags/v"}" + echo "version=NACOS_VERSION=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT" - name: Check out the repo - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 1 - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v3 - name: Log in to Docker Hub - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@v3 + uses: docker/metadata-action@v5 with: images: nacos/nacos-server flavor: | @@ -91,7 +86,7 @@ jobs: type=pep440,pattern=v{{version}}-slim - name: Build and push Docker image - uses: docker/build-push-action@v2.3.0 + uses: docker/build-push-action@v6 with: context: build platforms: linux/amd64,linux/arm64 @@ -99,4 +94,4 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - build-args: ${{steps.version_step.outputs.version}} + build-args: ${{ steps.version_step.outputs.version }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..d214b8dd --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,68 @@ +name: CI + +on: + pull_request: + branches: [master] + +jobs: + build-test: + name: Build Image + runs-on: ubuntu-latest + strategy: + matrix: + include: + - name: standard + file: build/Dockerfile + - name: slim + file: build/Dockerfile.Slim + steps: + - uses: actions/checkout@v4 + - uses: docker/setup-qemu-action@v3 + - uses: docker/setup-buildx-action@v3 + - name: Build ${{ matrix.name }} + uses: docker/build-push-action@v6 + with: + context: build + file: ${{ matrix.file }} + platforms: linux/amd64,linux/arm64 + push: false + load: false + + smoke-test: + name: Smoke Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: docker/setup-buildx-action@v3 + - name: Build image + uses: docker/build-push-action@v6 + with: + context: build + file: build/Dockerfile + platforms: linux/amd64 + push: false + load: true + tags: nacos-smoke:test + - name: Run smoke test + run: | + docker run -d --name nacos-test \ + -e MODE=standalone \ + -e NACOS_AUTH_TOKEN=VGhpc0lzTXlDdXN0b21TZWNyZXRLZXkwMTIzNDU2Nzg= \ + -e NACOS_AUTH_IDENTITY_KEY=test \ + -e NACOS_AUTH_IDENTITY_VALUE=test \ + -p 8848:8848 nacos-smoke:test + + echo "Waiting for Nacos to start..." + for i in $(seq 1 60); do + if curl -sf http://localhost:8848/nacos/ > /dev/null 2>&1; then + echo "Nacos is ready after $((i * 2))s" + exit 0 + fi + sleep 2 + done + echo "::error::Nacos failed to start within 120s" + docker logs nacos-test + exit 1 + - name: Cleanup + if: always() + run: docker rm -f nacos-test 2>/dev/null || true diff --git a/README.md b/README.md index 9e4caba1..a3f88753 100644 --- a/README.md +++ b/README.md @@ -185,6 +185,7 @@ Run the following command: | NACOS_AUTH_CONSOLE_ENABLE | nacos.core.auth.console.enable | default : `true` | | | NACOS_CONSOLE_PORT | nacos.console.port | default : `8080` | | NACOS_CONSOLE_CONTEXTPATH | nacos.console.contextPath | default : `` | +| NACOS_DEPLOYMENT_TYPE | nacos.deployment.type | default : `merged` support config `server` `console` | ## Advanced configuration diff --git a/README_ZH.md b/README_ZH.md index dda853b8..256f1c55 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -182,6 +182,7 @@ NACOS_VERSION=v3.0.2-slim | NACOS_AUTH_CONSOLE_ENABLE | nacos.core.auth.console.enable | default : `true` | | | NACOS_CONSOLE_PORT | nacos.console.port | default : `8080` | | NACOS_CONSOLE_CONTEXTPATH | nacos.console.contextPath | default : `` | +| NACOS_DEPLOYMENT_TYPE | nacos.deployment.type | default : `merged` 支持配置 `server` `console` | ## 高级配置