Merge pull request #76 from lingganwu/my-custom

Add GitHub Actions workflow for Docker image build
This commit is contained in:
ekko
2026-04-20 18:52:27 +08:00
committed by GitHub
2 changed files with 56 additions and 11 deletions
+43
View File
@@ -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 }}
+13 -11
View File
@@ -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 []