Files
svn-log-tool/Dockerfile
T
liumangmang 1b182c2930 feat: v2 Vue3 frontend + multiple optimizations
- New Vue 3 + Vite frontend at /v2/ (OLED dark theme, Fira Sans/Code)
- Date selector: support day/week/month range (backend unchanged)
- SSE auto-reconnect (up to 3 retries)
- Visibility polling pause (dashboard pauses when tab hidden)
- Friendly Chinese HTTP error messages
- Cancel task with confirmation in Dashboard
- Split AiWorkflowService (1700->845 lines):
  - AiApiService: AI API calls + streaming
  - ExcelExportService: POI Excel generation
- Dockerfile: 3-stage build (Node frontend -> Maven -> JRE)
- WebApplication.java: System.out -> Logger
- .gitignore: v2 build output, backup dirs

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-08 15:12:52 +08:00

62 lines
2.1 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ============================================================
# Docker 镜像仓库加速(默认使用 docker.1ms.run 国内代理)
# 如需切换回 Docker Hub
# docker compose build --build-arg REGISTRY_MIRROR=docker.io/library
# ============================================================
ARG REGISTRY_MIRROR=docker.1ms.run/library
# ============================================================
# Stage 1: 前端构建(Vue 3 + Vite
# ============================================================
FROM ${REGISTRY_MIRROR}/node:22-alpine AS frontend-builder
WORKDIR /frontend
COPY frontend-vue/package.json frontend-vue/package-lock.json ./
RUN npm ci
COPY frontend-vue/ ./
RUN npm run build
# ============================================================
# Stage 2: 后端构建(Maven + Java 8
# ============================================================
FROM ${REGISTRY_MIRROR}/maven:3.9.6-eclipse-temurin-8 AS builder
# Maven JVM 调优:增大堆内存、启用并行
ENV MAVEN_OPTS="-Xmx2g -XX:MaxMetaspaceSize=512m -Djava.util.concurrent.ForkJoinPool.common.parallelism=4"
WORKDIR /app
# 使用阿里云 Maven 镜像加速依赖下载(替换 Maven Central
COPY maven-settings.xml /root/.m2/settings.xml
COPY pom.xml .
RUN --mount=type=cache,target=/root/.m2 \
mvn -B -DskipTests -T 1C dependency:go-offline
COPY src ./src
# 将前端构建产物注入静态资源目录(Maven 会自动打包进 jar)
# vite.config.js 中 outDir 为相对 __dirname 的路径,容器内 __dirname=/frontend
COPY --from=frontend-builder /src/main/resources/static/v2 /app/src/main/resources/static/v2
# -T 1C: 按 CPU 核数并行; -o: 离线模式(依赖已缓存,跳过元数据检查)
RUN --mount=type=cache,target=/root/.m2 \
mvn -B -DskipTests -T 1C -o clean package
# ============================================================
# Stage 3: 运行镜像(最小化 JRE)
# ============================================================
FROM ${REGISTRY_MIRROR}/eclipse-temurin:8-jre-alpine
WORKDIR /app
COPY --from=builder /app/target/svn-log-tool-1.0.0-jar-with-dependencies.jar app.jar
EXPOSE 18088
ENTRYPOINT ["java", "-jar", "/app/app.jar"]