feat: 更新docker-compose.yml和GitHub工作流,移除sqlite-web服务,调整chat2db端口,优化Docker镜像构建流程,合并AMD64和ARM64构建步骤。
This commit is contained in:
138
.github/workflows/docker-image.yml
vendored
138
.github/workflows/docker-image.yml
vendored
@@ -12,35 +12,17 @@ on:
|
|||||||
- "*.*.*"
|
- "*.*.*"
|
||||||
- "*.*.*-*"
|
- "*.*.*-*"
|
||||||
|
|
||||||
|
# Workflow's jobs
|
||||||
jobs:
|
jobs:
|
||||||
build-amd64:
|
docker:
|
||||||
name: Build AMD64 Image
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
|
||||||
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Check out git repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Clone maim_message
|
# Generate metadata for Docker images
|
||||||
run: git clone https://github.com/MaiM-with-u/maim_message maim_message
|
|
||||||
|
|
||||||
- name: Clone lpmm
|
|
||||||
run: git clone https://github.com/MaiM-with-u/MaiMBot-LPMM.git MaiMBot-LPMM
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
with:
|
|
||||||
buildkitd-flags: --debug
|
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Docker meta
|
- name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
@@ -55,120 +37,50 @@ jobs:
|
|||||||
type=semver,pattern={{major}}
|
type=semver,pattern={{major}}
|
||||||
type=sha
|
type=sha
|
||||||
|
|
||||||
- name: Build and Push AMD64 Docker Image
|
# Outputting basic information
|
||||||
uses: docker/build-push-action@v5
|
- name: Print basic information
|
||||||
with:
|
run: |
|
||||||
context: .
|
echo "Generated tags: ${{ steps.meta.outputs.tags }}"
|
||||||
file: ./Dockerfile
|
echo "Generated labels: ${{ steps.meta.outputs.labels }}"
|
||||||
platforms: linux/amd64
|
|
||||||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/maibot:amd64-${{ github.sha }}
|
|
||||||
push: true
|
|
||||||
cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/maibot:amd64-buildcache
|
|
||||||
cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/maibot:amd64-buildcache,mode=max
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
provenance: true
|
|
||||||
sbom: true
|
|
||||||
build-args: |
|
|
||||||
BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
|
||||||
VCS_REF=${{ github.sha }}
|
|
||||||
outputs: type=image,push=true
|
|
||||||
|
|
||||||
build-arm64:
|
# Clone required dependencies
|
||||||
name: Build ARM64 Image
|
- name: Clone maim_message
|
||||||
runs-on: ubuntu-latest
|
run: git clone https://github.com/MaiM-with-u/maim_message maim_message
|
||||||
env:
|
|
||||||
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USERNAME }}
|
- name: Clone lpmm
|
||||||
steps:
|
run: git clone https://github.com/MaiM-with-u/MaiMBot-LPMM.git MaiMBot-LPMM
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
|
with:
|
||||||
- name: Clone maim_message
|
platforms: amd64,arm64
|
||||||
run: git clone https://github.com/MaiM-with-u/maim_message maim_message
|
|
||||||
|
|
||||||
- name: Clone lpmm
|
|
||||||
run: git clone https://github.com/MaiM-with-u/MaiMBot-LPMM.git MaiMBot-LPMM
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
with:
|
with:
|
||||||
buildkitd-flags: --debug
|
buildkitd-flags: --debug
|
||||||
|
|
||||||
|
# Log in docker hub
|
||||||
- name: Log in to Docker Hub
|
- name: Log in to Docker Hub
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Docker meta
|
# Packaging and sending to Docker
|
||||||
id: meta
|
- name: Build and push
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: ${{ secrets.DOCKERHUB_USERNAME }}/maibot
|
|
||||||
tags: |
|
|
||||||
type=ref,event=branch
|
|
||||||
type=ref,event=tag
|
|
||||||
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
|
||||||
type=semver,pattern={{major}}
|
|
||||||
type=sha
|
|
||||||
|
|
||||||
- name: Build and Push ARM64 Docker Image
|
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./Dockerfile
|
|
||||||
platforms: linux/arm64
|
|
||||||
tags: ${{ secrets.DOCKERHUB_USERNAME }}/maibot:arm64-${{ github.sha }}
|
|
||||||
push: true
|
push: true
|
||||||
cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/maibot:arm64-buildcache
|
platforms: linux/amd64,linux/arm64/v8
|
||||||
cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/maibot:arm64-buildcache,mode=max
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
file: ./Dockerfile
|
||||||
|
cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/maibot:buildcache
|
||||||
|
cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/maibot:buildcache,mode=max
|
||||||
provenance: true
|
provenance: true
|
||||||
sbom: true
|
sbom: true
|
||||||
build-args: |
|
build-args: |
|
||||||
BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
|
||||||
VCS_REF=${{ github.sha }}
|
VCS_REF=${{ github.sha }}
|
||||||
outputs: type=image,push=true
|
|
||||||
|
|
||||||
create-manifest:
|
|
||||||
name: Create Multi-Arch Manifest
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs:
|
|
||||||
- build-amd64
|
|
||||||
- build-arm64
|
|
||||||
steps:
|
|
||||||
- name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Docker meta
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: ${{ secrets.DOCKERHUB_USERNAME }}/maibot
|
|
||||||
tags: |
|
|
||||||
type=ref,event=branch
|
|
||||||
type=ref,event=tag
|
|
||||||
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
|
||||||
type=semver,pattern={{major}}
|
|
||||||
type=sha
|
|
||||||
|
|
||||||
- name: Create and Push Manifest
|
|
||||||
run: |
|
|
||||||
# 为每个标签创建多架构镜像
|
|
||||||
for tag in $(echo "${{ steps.meta.outputs.tags }}" | tr '\n' ' '); do
|
|
||||||
echo "Creating manifest for $tag"
|
|
||||||
docker buildx imagetools create -t $tag \
|
|
||||||
${{ secrets.DOCKERHUB_USERNAME }}/maibot:amd64-${{ github.sha }} \
|
|
||||||
${{ secrets.DOCKERHUB_USERNAME }}/maibot:arm64-${{ github.sha }}
|
|
||||||
done
|
|
||||||
@@ -17,7 +17,6 @@ services:
|
|||||||
restart: always
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
- maim_bot
|
- maim_bot
|
||||||
|
|
||||||
core:
|
core:
|
||||||
container_name: maim-bot-core
|
container_name: maim-bot-core
|
||||||
#### prod ####
|
#### prod ####
|
||||||
@@ -40,7 +39,6 @@ services:
|
|||||||
restart: always
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
- maim_bot
|
- maim_bot
|
||||||
|
|
||||||
napcat:
|
napcat:
|
||||||
environment:
|
environment:
|
||||||
- NAPCAT_UID=1000
|
- NAPCAT_UID=1000
|
||||||
@@ -57,20 +55,28 @@ services:
|
|||||||
image: mlikiowa/napcat-docker:latest
|
image: mlikiowa/napcat-docker:latest
|
||||||
networks:
|
networks:
|
||||||
- maim_bot
|
- maim_bot
|
||||||
|
# sqlite-web:
|
||||||
sqlite-web:
|
# image: coleifer/sqlite-web
|
||||||
image: coleifer/sqlite-web
|
# container_name: sqlite-web
|
||||||
container_name: sqlite-web
|
# restart: always
|
||||||
|
# ports:
|
||||||
|
# - "8120:8080"
|
||||||
|
# volumes:
|
||||||
|
# - ./data/MaiMBot:/data/MaiMBot
|
||||||
|
# environment:
|
||||||
|
# - SQLITE_DATABASE=MaiMBot/MaiBot.db # 你的数据库文件
|
||||||
|
# networks:
|
||||||
|
# - maim_bot
|
||||||
|
chat2db:
|
||||||
|
image: chat2db/chat2db:latest
|
||||||
|
container_name: maim-bot-chat2db
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- "8120:8080"
|
- "10824:10824"
|
||||||
volumes:
|
volumes:
|
||||||
- ./data/MaiMBot:/data/MaiMBot
|
- ./data/MaiMBot:/data/MaiMBot
|
||||||
environment:
|
|
||||||
- SQLITE_DATABASE=MaiMBot/MaiBot.db # 你的数据库文件
|
|
||||||
networks:
|
networks:
|
||||||
- maim_bot
|
- maim_bot
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
maim_bot:
|
maim_bot:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
|
|||||||
Reference in New Issue
Block a user