From 11621246d0ba7b098e48821a6eb9f053bb2dea15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=81=B5=E6=84=9F=E5=B1=8B?= Date: Mon, 20 Apr 2026 14:09:42 +0800 Subject: [PATCH 1/2] Add GitHub Actions workflow for Docker image build --- .github/workflows/docker-publish.yml | 43 ++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/docker-publish.yml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..86f9cc9 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,43 @@ +name: Build and Push Docker Image to Docker Hub + +# 触发条件配置 +on: + push: + branches: + - main + - dev-custom # 如果你新建了分支,确保你的分支名在这里 + - my-custom # 替换为你实际使用的分支名 + workflow_dispatch: # 允许在 GitHub 网页端手动点击按钮触发 + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + # 1. 检出当前仓库代码 + - name: Checkout repository + uses: actions/checkout@v4 + + # 2. 设置 Docker Buildx (用于构建镜像的高级工具) + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + # 3. 登录到 Docker Hub (使用你截图里配置的 Secrets) + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + # 4. 构建并推送镜像 + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + # 根据仓库根目录的 Dockerfile 构建 + file: ./Dockerfile + push: true + # 这里的标签会自动加上你的 DockerHub 用户名,以及 hermes-web-ui 仓库名 + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/hermes-web-ui:latest + ${{ secrets.DOCKERHUB_USERNAME }}/hermes-web-ui:${{ github.sha }} From 7477f18abe0521464e9f45f480017a1cd7020a79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=81=B5=E6=84=9F=E5=B1=8B?= Date: Mon, 20 Apr 2026 15:59:09 +0800 Subject: [PATCH 2/2] Update Dockerfile --- Dockerfile | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3ed25fe..96afe43 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,16 +4,16 @@ FROM ${BASE_IMAGE} USER root RUN apt-get update && apt-get install -y --no-install-recommends \ - ca-certificates \ - curl \ - gnupg \ - python3 \ - python3-yaml \ - make \ - g++ \ - && curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \ - && apt-get install -y --no-install-recommends nodejs \ - && rm -rf /var/lib/apt/lists/* + ca-certificates \ + curl \ + gnupg \ + python3 \ + python3-yaml \ + make \ + g++ \ + && curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \ + && apt-get install -y --no-install-recommends nodejs \ + && rm -rf /var/lib/apt/lists/* WORKDIR /app @@ -30,4 +30,6 @@ ENV HERMES_HOME=/home/agent/.hermes EXPOSE 6060 -CMD ["node", "dist/server/index.js"] +# 强制覆盖基础镜像的默认启动脚本,让镜像本身具备独立运行的能力 +ENTRYPOINT ["node", "dist/server/index.js"] +CMD []