mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-29 05:09:46 +01:00
update:测试新版镜像自动化编译
This commit is contained in:
parent
58d720115e
commit
26c9047789
6 changed files with 54 additions and 4949 deletions
37
.github/workflows/docker-image.yml
vendored
37
.github/workflows/docker-image.yml
vendored
|
|
@ -7,30 +7,31 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
name: Release Docker image
|
name: Release Docker images
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
packages: write
|
packages: write
|
||||||
contents: write
|
contents: write
|
||||||
id-token: write
|
id-token: write
|
||||||
issues: write
|
issues: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check Disk Space
|
- name: Check Disk Space
|
||||||
run: |
|
run: |
|
||||||
df -h
|
df -h
|
||||||
docker system df
|
docker system df
|
||||||
|
|
||||||
- name: Clean up Docker resources
|
- name: Clean up Docker resources
|
||||||
run: |
|
run: |
|
||||||
docker system prune -af
|
docker system prune -af
|
||||||
docker builder prune -af
|
docker builder prune -af
|
||||||
- name: Check out the repo
|
|
||||||
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Log in to the GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
|
|
@ -42,13 +43,35 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Build and push Docker image
|
# 构建 xiaozhi-server 镜像
|
||||||
id: build_push
|
- name: Build and push xiaozhi-server
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: ./xiaozhi-server
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
ghcr.io/${{ github.repository }}:${{ env.VERSION }}
|
ghcr.io/${{ github.repository }}:${{ env.VERSION }}
|
||||||
ghcr.io/${{ github.repository }}:latest
|
ghcr.io/${{ github.repository }}:latest
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
|
|
||||||
|
# 构建 manager-web 镜像
|
||||||
|
- name: Build and push manager-web
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: ./manager-web
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
ghcr.io/${{ github.repository }}:manager_web_${{ env.VERSION }}
|
||||||
|
ghcr.io/${{ github.repository }}:manager_web_latest
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
|
||||||
|
# 构建 manager-api 镜像
|
||||||
|
- name: Build and push manager-api
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: ./manager-api
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
ghcr.io/${{ github.repository }}:manager_api_${{ env.VERSION }}
|
||||||
|
ghcr.io/${{ github.repository }}:manager_api_latest
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
29
Dockerfile
29
Dockerfile
|
|
@ -1,29 +0,0 @@
|
||||||
# 第一阶段:构建Python依赖
|
|
||||||
FROM python:3.10-slim AS builder
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
COPY main/xiaozhi-server/requirements.txt .
|
|
||||||
|
|
||||||
# 优化apt安装
|
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
|
||||||
|
|
||||||
# 第三阶段:生产镜像
|
|
||||||
FROM python:3.10-slim
|
|
||||||
|
|
||||||
WORKDIR /opt/xiaozhi-esp32-server
|
|
||||||
|
|
||||||
# 优化apt安装
|
|
||||||
RUN apt-get update && \
|
|
||||||
apt-get install -y --no-install-recommends libopus0 ffmpeg && \
|
|
||||||
apt-get clean && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# 从构建阶段复制Python包和前端构建产物
|
|
||||||
COPY --from=builder /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages
|
|
||||||
|
|
||||||
# 复制应用代码
|
|
||||||
COPY main/xiaozhi-server/ .
|
|
||||||
|
|
||||||
# 启动应用
|
|
||||||
CMD ["python", "app.py"]
|
|
||||||
|
|
@ -3,11 +3,5 @@ __pycache__
|
||||||
*.pyc
|
*.pyc
|
||||||
.env
|
.env
|
||||||
Dockerfile
|
Dockerfile
|
||||||
../docs/
|
|
||||||
tmp/
|
tmp/
|
||||||
data/
|
data/
|
||||||
LICENSE
|
|
||||||
README.md
|
|
||||||
README_en.md
|
|
||||||
manager/static
|
|
||||||
manager/static/webui/
|
|
||||||
|
|
@ -1,16 +1,29 @@
|
||||||
# 第一阶段:构建Python依赖
|
# 第一阶段:构建Python依赖
|
||||||
FROM kalicyh/poetry:v3.10_xiaozhi AS builder
|
FROM python:3.10-slim AS builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY requirements.txt .
|
||||||
|
|
||||||
|
# 优化apt安装
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
# 第三阶段:生产镜像
|
||||||
|
FROM python:3.10-slim
|
||||||
|
|
||||||
WORKDIR /opt/xiaozhi-esp32-server
|
WORKDIR /opt/xiaozhi-esp32-server
|
||||||
|
|
||||||
# 同时拷贝本地环境.venv
|
# 优化apt安装
|
||||||
COPY . .
|
RUN apt-get update && \
|
||||||
# 检查是否有缺失
|
apt-get install -y --no-install-recommends libopus0 ffmpeg && \
|
||||||
RUN poetry install --no-root
|
apt-get clean && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# 设置虚拟环境路径
|
# 从构建阶段复制Python包和前端构建产物
|
||||||
ENV PATH="/app/.venv/bin:$PATH"
|
COPY --from=builder /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages
|
||||||
|
|
||||||
|
# 复制应用代码
|
||||||
|
COPY . .
|
||||||
|
|
||||||
# 启动应用
|
# 启动应用
|
||||||
ENTRYPOINT ["poetry", "run", "python"]
|
CMD ["python", "app.py"]
|
||||||
CMD ["app.py"]
|
|
||||||
4854
main/xiaozhi-server/poetry.lock
generated
4854
main/xiaozhi-server/poetry.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -1,42 +0,0 @@
|
||||||
[tool.poetry]
|
|
||||||
name = "xiaozhi-esp32-server"
|
|
||||||
version = "0.1.0"
|
|
||||||
description = ""
|
|
||||||
authors = ["kalicyh <34980061+kaliCYH@users.noreply.github.com>"]
|
|
||||||
readme = "README.md"
|
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
|
||||||
python = "^3.10"
|
|
||||||
pyyml = "0.0.2"
|
|
||||||
torch = "2.2.2"
|
|
||||||
silero-vad = "5.1.2"
|
|
||||||
websockets = "14.2"
|
|
||||||
numpy = "1.26.4"
|
|
||||||
pydub = "0.25.1"
|
|
||||||
funasr = "1.2.3"
|
|
||||||
torchaudio = "2.2.2"
|
|
||||||
openai = "1.61.0"
|
|
||||||
google-generativeai = "0.8.4"
|
|
||||||
edge-tts = "7.0.0"
|
|
||||||
httpx = "0.27.2"
|
|
||||||
aiohttp = "3.9.3"
|
|
||||||
aiohttp-cors = "0.7.0"
|
|
||||||
ormsgpack = "1.7.0"
|
|
||||||
ruamel-yaml = "0.18.10"
|
|
||||||
setuptools = "^75.8.0"
|
|
||||||
loguru = "^0.7.3"
|
|
||||||
opuslib-next = "^1.1.2"
|
|
||||||
fastapi = {extras = ["all"], version = "^0.115.8"}
|
|
||||||
uvicorn = "^0.34.0"
|
|
||||||
pyjwt = "^2.10.1"
|
|
||||||
python-jose = {extras = ["cryptography"], version = "^3.3.0"}
|
|
||||||
bcrypt = "^4.2.1"
|
|
||||||
sqlalchemy = "^2.0.38"
|
|
||||||
pymysql = "^1.1.1"
|
|
||||||
asyncpg = "^0.30.0"
|
|
||||||
onnxruntime = "1.19.2"
|
|
||||||
|
|
||||||
|
|
||||||
[build-system]
|
|
||||||
requires = ["poetry-core"]
|
|
||||||
build-backend = "poetry.core.masonry.api"
|
|
||||||
Loading…
Reference in a new issue