-
Notifications
You must be signed in to change notification settings - Fork 6
Feature: add Docker support #116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
FjHe
wants to merge
4
commits into
MaloneTalk:main
Choose a base branch
from
FjHe:docker_support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # Dependencies | ||
| node_modules/ | ||
| .pnpm-store/ | ||
|
|
||
| # Build output | ||
| dist/ | ||
| build/ | ||
| target/ | ||
|
|
||
| # IDE files | ||
| .idea/ | ||
| .vscode/ | ||
| *.swp | ||
| *.swo | ||
|
|
||
| # OS files | ||
| .DS_Store | ||
| Thumbs.db | ||
|
|
||
| # Logs | ||
| *.log | ||
| npm-debug.log* | ||
| pnpm-debug.log* | ||
|
|
||
| # Git files | ||
| .git/ | ||
| .gitignore | ||
|
|
||
| # Docker files (避免递归,但保留需要的配置文件) | ||
| docker/backend/ | ||
| docker/frontend/Dockerfile | ||
| docker/.env | ||
| docker/.env.example | ||
| docker/docker-compose.yml | ||
| docker/docker-*.sh | ||
| docker/docker-*.bat | ||
|
|
||
| # Test files | ||
| coverage/ | ||
| .nyc_output/ | ||
| .playwright-cli/ | ||
|
|
||
| # Documentation | ||
| *.md | ||
| docs/ | ||
|
|
||
| # Root config files (不需要复制到镜像) | ||
| .env | ||
| .gitattributes | ||
| .github/ | ||
| AGENTS.md | ||
| LICENSE | ||
|
|
||
| # SQL files (通过 volume 挂载,不需要复制) | ||
| sql/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # Build artifacts | ||
| target/ | ||
| !.mvn/wrapper/maven-wrapper.jar | ||
|
|
||
| # IDE files | ||
| .idea/ | ||
| *.iml | ||
| *.iws | ||
| *.ipr | ||
|
|
||
| # OS files | ||
| .DS_Store | ||
| Thumbs.db | ||
|
|
||
| # Logs | ||
| *.log | ||
|
|
||
| # Git files | ||
| .git/ | ||
| .gitignore | ||
|
|
||
| # Docker files | ||
| Dockerfile | ||
| docker/ | ||
|
|
||
| # Documentation | ||
| README.md | ||
| docs/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # Dependencies | ||
| node_modules/ | ||
| .pnpm-store/ | ||
|
|
||
| # Build output | ||
| dist/ | ||
| build/ | ||
|
|
||
| # IDE files | ||
| .idea/ | ||
| .vscode/ | ||
| *.swp | ||
| *.swo | ||
|
|
||
| # OS files | ||
| .DS_Store | ||
| Thumbs.db | ||
|
|
||
| # Logs | ||
| *.log | ||
| npm-debug.log* | ||
| pnpm-debug.log* | ||
|
|
||
| # Git files | ||
| .git/ | ||
| .gitignore | ||
|
|
||
| # Docker files | ||
| Dockerfile | ||
| docker/ | ||
|
|
||
| # Test files | ||
| coverage/ | ||
| .nyc_output/ | ||
| .playwright-cli/ | ||
|
|
||
| # Documentation | ||
| README.md | ||
| docs/ | ||
| CODE_STYLE.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Data Agent 环境变量配置 | ||
| # 此文件不应提交到 Git(已在 .gitignore 中) | ||
|
|
||
| # AI 模型配置 (必填) | ||
| IO_GITHUB_MALONETALK_MODEL_API_KEY= | ||
| IO_GITHUB_MALONETALK_MODEL_PROVIDER=openai | ||
| IO_GITHUB_MALONETALK_MODEL_NAME=deepseek-v4-flash | ||
| IO_GITHUB_MALONETALK_MODEL_BASE_URL=https://api.deepseek.com | ||
| IO_GITHUB_MALONETALK_MODEL_THINKING_ENABLED=true | ||
|
|
||
| # 数据库配置 | ||
| DB_PASSWORD=root | ||
|
|
||
| # JWT 配置(生产环境必须 >= 32 字节) | ||
| JWT_SECRET= | ||
|
|
||
| # 管理员配置(首次启动时使用) | ||
| ADMIN_INIT_PASSWORD=admin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # Stage 1: Build (使用 maven 镜像,自带 Maven) | ||
| FROM maven:3.9-eclipse-temurin-17 AS builder | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| # Maven 依赖默认直连 Maven Central。国内网络拉取易中断导致构建失败时, | ||
| # 取消下面整段注释,改用阿里云镜像源: | ||
| # RUN mkdir -p /root/.m2 && echo '<settings>\ | ||
| # <mirrors>\ | ||
| # <mirror>\ | ||
| # <id>aliyun</id>\ | ||
| # <url>https://maven.aliyun.com/repository/public</url>\ | ||
| # <mirrorOf>*</mirrorOf>\ | ||
| # </mirror>\ | ||
| # </mirrors>\ | ||
| # </settings>' > /root/.m2/settings.xml | ||
|
|
||
| # Copy pom.xml and download dependencies | ||
| COPY data-agent-backend/pom.xml . | ||
| RUN mvn dependency:go-offline -B | ||
|
|
||
| # Copy source code and build | ||
| COPY data-agent-backend/src ./src | ||
| RUN mvn clean package -DskipTests -B | ||
|
|
||
| # Stage 2: Runtime | ||
| FROM eclipse-temurin:17-jre-alpine | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| # Skills 目录(skill.properties 的 filesystem 源) | ||
| COPY skills/ /app/skills/ | ||
|
|
||
| # Add non-root user | ||
| RUN addgroup -g 1001 appgroup && \ | ||
| adduser -u 1001 -G appgroup -D appuser | ||
|
|
||
| # Copy the built jar | ||
| COPY --from=builder /app/target/*.jar app.jar | ||
|
|
||
| # Create log directory | ||
| RUN mkdir -p /app/logs && chown -R appuser:appgroup /app | ||
|
|
||
| USER appuser | ||
|
|
||
| # Health check | ||
| HEALTHCHECK --interval=30s --timeout=10s --retries=3 \ | ||
| CMD wget --no-verbose --tries=1 --spider http://localhost:8080/actuator/health || exit 1 | ||
|
|
||
| ENTRYPOINT ["java", "-jar", "app.jar"] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| # Data Agent Docker Compose Configuration | ||
| # | ||
| # 所有配置项都有合理的默认值,可以直接启动。 | ||
| # 如需自定义配置:cp .env.example .env,然后编辑 .env。 | ||
| # | ||
|
|
||
| services: | ||
| # MySQL Database | ||
| mysql: | ||
| image: mysql:8.0 | ||
| container_name: data-agent-mysql | ||
| restart: unless-stopped | ||
| environment: | ||
| # 可通过 .env.example 覆盖:DB_PASSWORD=xxx | ||
| MYSQL_ROOT_PASSWORD: ${DB_PASSWORD:-root} | ||
| MYSQL_DATABASE: data_agent | ||
| MYSQL_CHARACTER_SET_SERVER: utf8mb4 | ||
| MYSQL_COLLATION_SERVER: utf8mb4_unicode_ci | ||
| TZ: Asia/Shanghai | ||
| ports: | ||
| # 可通过 .env.example 覆盖:MYSQL_PORT=3307 | ||
| - "${MYSQL_PORT:-3306}:3306" | ||
| volumes: | ||
| - data-agent-mysql:/var/lib/mysql | ||
| # 自动挂载项目根目录的 sql/ 文件夹进行初始化 | ||
| - ../sql:/docker-entrypoint-initdb.d:ro | ||
| command: | ||
| - --character-set-server=utf8mb4 | ||
| - --collation-server=utf8mb4_unicode_ci | ||
| - --character-set-client-handshake=FALSE | ||
| - --init-connect='SET NAMES utf8mb4' | ||
| - --default-authentication-plugin=mysql_native_password | ||
| networks: | ||
| - data-agent-network | ||
| healthcheck: | ||
| # 使用 mysql 命令实际测试数据库连接和查询 | ||
| test: ["CMD", "mysql", "-h", "localhost", "-u", "root", "-p${DB_PASSWORD:-root}", "-e", "SELECT 1 FROM data_agent.sys_user LIMIT 1;"] | ||
| interval: 10s | ||
| timeout: 10s | ||
| retries: 10 | ||
| start_period: 60s | ||
|
|
||
| # Backend Service (Spring Boot) | ||
| backend: | ||
| build: | ||
| context: .. | ||
| dockerfile: docker/backend/Dockerfile | ||
| container_name: data-agent-backend | ||
| restart: unless-stopped | ||
| environment: | ||
| # 数据库配置(通常不需要修改) | ||
| DB_URL: ${DB_URL:-jdbc:mysql://mysql:3306/data_agent?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true} | ||
| DB_USERNAME: ${DB_USERNAME:-root} | ||
| DB_PASSWORD: ${DB_PASSWORD:-root} | ||
|
|
||
| # AI 模型配置(重要:需要配置真实的 API Key) | ||
| # 可通过 .env.example 覆盖:IO_GITHUB_MALONETALK_MODEL_API_KEY=sk-xxx | ||
| IO_GITHUB_MALONETALK_MODEL_PROVIDER: ${IO_GITHUB_MALONETALK_MODEL_PROVIDER:-dashscope} | ||
| IO_GITHUB_MALONETALK_MODEL_NAME: ${IO_GITHUB_MALONETALK_MODEL_NAME:-qwen3-max} | ||
| IO_GITHUB_MALONETALK_MODEL_BASE_URL: ${IO_GITHUB_MALONETALK_MODEL_BASE_URL:-} | ||
| IO_GITHUB_MALONETALK_MODEL_API_KEY: ${IO_GITHUB_MALONETALK_MODEL_API_KEY:-} | ||
| IO_GITHUB_MALONETALK_MODEL_THINKING_ENABLED: ${IO_GITHUB_MALONETALK_MODEL_THINKING_ENABLED:-false} | ||
|
|
||
| # JWT 配置(可通过 .env.example 覆盖) | ||
| # JWT_SECRET 必须 >= 32 字节 | ||
| JWT_SECRET: ${JWT_SECRET:-} | ||
| JWT_EXPIRATION_HOURS: ${JWT_EXPIRATION_HOURS:-24} | ||
|
|
||
| # 初始管理员密码(首次启动时使用) | ||
| ADMIN_INIT_PASSWORD: ${ADMIN_INIT_PASSWORD:-admin} | ||
|
|
||
| TZ: Asia/Shanghai | ||
| ports: | ||
| # 可通过 .env.example 覆盖:BACKEND_PORT=8081 | ||
| - "${BACKEND_PORT:-8080}:8080" | ||
| depends_on: | ||
| mysql: | ||
| condition: service_healthy | ||
| networks: | ||
| - data-agent-network | ||
|
|
||
| # Frontend Service (Vue + Nginx) | ||
| frontend: | ||
| build: | ||
| context: .. | ||
| dockerfile: docker/frontend/Dockerfile | ||
| container_name: data-agent-frontend | ||
| restart: unless-stopped | ||
| ports: | ||
| # 可通过 .env.example 覆盖:FRONTEND_PORT=3001 | ||
| - "${FRONTEND_PORT:-3000}:80" | ||
| depends_on: | ||
| backend: | ||
| condition: service_healthy | ||
| networks: | ||
| - data-agent-network | ||
|
|
||
| volumes: | ||
| data-agent-mysql: | ||
| name: data-agent-mysql | ||
|
|
||
| networks: | ||
| data-agent-network: | ||
| name: data-agent-network |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # Stage 1: Build | ||
| FROM node:20-alpine AS builder | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| # 直接安装 pnpm(不使用 corepack) | ||
| RUN npm install -g pnpm | ||
|
|
||
| # 先复制所有源代码(.dockerignore 会排除不需要的文件) | ||
| COPY data-agent-frontend/ . | ||
|
|
||
| # 再安装依赖 | ||
| RUN pnpm install --frozen-lockfile | ||
|
|
||
| # Build the application (跳过类型检查,直接打包) | ||
| RUN pnpm vite build | ||
|
|
||
| # Stage 2: Production with Nginx | ||
| FROM nginx:alpine | ||
|
|
||
| # Copy custom nginx config | ||
| COPY docker/frontend/nginx.conf /etc/nginx/nginx.conf | ||
|
|
||
| # Copy built files | ||
| COPY --from=builder /app/dist /usr/share/nginx/html | ||
|
|
||
| # Add healthcheck | ||
| HEALTHCHECK --interval=30s --timeout=10s --retries=3 \ | ||
| CMD wget --no-verbose --tries=1 --spider http://127.0.0.1/health || exit 1 | ||
|
|
||
| CMD ["nginx", "-g", "daemon off;"] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.