Files
Mofox-Core/.github/workflows/docker-image.yml
雅诺狐 3155c4713f Remove Nix, pre-commit, and related config files
Deleted Nix flake files, pre-commit configuration, environment files, sample data, and a batch script. Also commented out automatic triggers in the Docker GitHub Actions workflow, leaving only manual dispatch. This simplifies the repository by removing development environment and automation tooling.

Co-Authored-By: tt-P607 <68868379+tt-P607@users.noreply.github.com>
2025-08-17 21:03:27 +08:00

82 lines
2.3 KiB
YAML

name: Docker CI
on:
# push:
# branches:
# - master
# - develop
# tags:
# - "v*.*.*"
# - "v*"
# - "*.*.*"
# - "*.*.*-*"
workflow_dispatch: # 允许手动触发工作流
jobs:
build-amd64:
name: 构建 AMD64 镜像
runs-on: ubuntu-24.04
outputs:
digest: ${{ steps.build.outputs.digest }}
steps:
- name: 检出 Git 仓库
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 克隆 maim_message
uses: actions/checkout@v4
with:
repository: MaiM-with-u/maim_message
path: maim_message
- name: 克隆 MaiMBot-LPMM
uses: actions/checkout@v4
with:
repository: MaiM-with-u/MaiMBot-LPMM
path: MaiMBot-LPMM
- name: 设置 Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
- name: 登录到 Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker 元数据
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ secrets.DOCKERHUB_USERNAME }}/maibot
- name: 动态生成镜像标签
id: tag
run: |
if [ "$GITHUB_REF" == "refs/heads/master" ]; then
echo "tag=latest" >> $GITHUB_ENV
elif [ "$GITHUB_REF" == "refs/heads/develop" ]; then
echo "tag=dev" >> $GITHUB_ENV
else
echo "tag=${{ github.ref_name }}" >> $GITHUB_ENV
fi
- name: 构建并推送 AMD64 镜像
id: build
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
labels: ${{ steps.meta.outputs.labels }}
file: ./Dockerfile
cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/maibot:amd64-buildcache
cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/maibot:amd64-buildcache,mode=max
outputs: type=image,name=${{ secrets.DOCKERHUB_USERNAME }}/maibot:${{ env.tag }},name-canonical=true,push=true
build-args: |
BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
VCS_REF=${{ github.sha }}
BRANCH_NAME=${{ github.ref_name }}