diff --git a/docker-compose.yml b/docker-compose.yml index 5849cfb9..c6c11c8b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,8 +21,9 @@ services: - "3306:3306" volumes: - mysql_data:/var/lib/mysql - - ./mateclaw-server/src/main/resources/db/schema.sql:/docker-entrypoint-initdb.d/01-schema.sql - - ./mateclaw-server/src/main/resources/db/data.sql:/docker-entrypoint-initdb.d/02-data.sql + # Schema and seed data are managed by Flyway on application startup. + # Do NOT mount legacy schema.sql / data.sql here — Flyway creates all + # tables from V1 baseline and applies incremental migrations automatically. command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci healthcheck: test: ["CMD", "mysqladmin", "ping", "-h", "localhost"] @@ -71,7 +72,7 @@ services: JWT_SECRET: ${JWT_SECRET:-} MATECLAW_CORS_ALLOWED_ORIGINS: ${MATECLAW_CORS_ALLOWED_ORIGINS:-} ports: - - "18080:18080" + - "18080:18088" # host:container — app listens on 18088 inside the container volumes: - server_data:/app/data diff --git a/mateclaw-server/Dockerfile b/mateclaw-server/Dockerfile index 2856f6e4..b476c703 100644 --- a/mateclaw-server/Dockerfile +++ b/mateclaw-server/Dockerfile @@ -1,16 +1,21 @@ -# 多阶段构建 +# Multi-stage build FROM maven:3.9-eclipse-temurin-21 AS builder -# 先构建并安装 plugin-api 到本地 Maven 缓存 +# Inject mirror settings to avoid Maven Central timeouts in restricted networks +COPY mateclaw-server/settings.xml /root/.m2/settings.xml + +# Build and install plugin-api into the local Maven cache first WORKDIR /plugin-api COPY mateclaw-plugin-api/pom.xml ./pom.xml COPY mateclaw-plugin-api/src ./src RUN mvn install -DskipTests -q -# 再构建 mateclaw-server +# Pre-fetch mateclaw-server dependencies (uses mirror, so this won't hang) WORKDIR /build COPY mateclaw-server/pom.xml . RUN mvn dependency:go-offline -q + +# Build the final JAR COPY mateclaw-server/src ./src RUN mvn package -DskipTests -q diff --git a/mateclaw-server/settings.xml b/mateclaw-server/settings.xml new file mode 100644 index 00000000..ed9dbf17 --- /dev/null +++ b/mateclaw-server/settings.xml @@ -0,0 +1,25 @@ + + + + + + aliyun-public + central + Aliyun Public Repository + https://maven.aliyun.com/repository/public + + + aliyun-spring + spring-milestones,spring-snapshots + Aliyun Spring Repository + https://maven.aliyun.com/repository/spring + + +