Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 16 additions & 21 deletions .github/workflows/build&push.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -18,41 +13,41 @@ 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
file: build/Dockerfile
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
Expand All @@ -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: |
Expand All @@ -91,12 +86,12 @@ 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
file: build/Dockerfile.Slim
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 }}
68 changes: 68 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` |

## 高级配置

Expand Down
Loading