Files
martial-master/Dockerfile.fullbuild
宅房 86e4580e5d feat: add multi-stage Dockerfile for full build with martial-tool
- Add Dockerfile.fullbuild: multi-stage build that compiles martial-tool
- Rename Dockerfile to Dockerfile.quick for quick builds (pre-built jar)
- Update docker-compose.yml to use parent directory context
- Update README with new deployment instructions
2025-12-29 14:34:54 +08:00

51 lines
1.4 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.
# ============================================
# 武术赛事管理系统 - 完整构建 Dockerfile
# 包含 martial-tool 编译 + martial-master 编译
# ============================================
# 构建阶段:使用 Maven + JDK 镜像
FROM maven:3.9-eclipse-temurin-17 AS builder
WORKDIR /build
# 复制 martial-toolBladeX 框架)
COPY martial-tool /build/martial-tool
# 编译 martial-tool 并安装到本地仓库
RUN cd /build/martial-tool && \
mvn clean install -DskipTests -q
# 复制 martial-master后端项目
COPY martial-master /build/martial-master
# 编译 martial-master
RUN cd /build/martial-master && \
mvn clean package -DskipTests -q
# ============================================
# 运行阶段:使用轻量级 JRE 镜像
# ============================================
FROM eclipse-temurin:17-jre-jammy
LABEL maintainer="JohnSion"
LABEL description="武术比赛管理系统后端服务"
WORKDIR /app
# 从构建阶段复制 JAR 文件
COPY --from=builder /build/martial-master/target/blade-api.jar /app/blade-api.jar
# 暴露端口
EXPOSE 8123
# 健康检查
HEALTHCHECK --interval=30s --timeout=3s --start-period=60s --retries=3 \
CMD curl -f http://localhost:8123/actuator/health || exit 1
# JVM 参数配置
ENV JAVA_OPTS="-Xms512m -Xmx1024m -XX:+UseG1GC"
ENV SPRING_PROFILE="dev"
# 启动命令
CMD ["sh", "-c", "java ${JAVA_OPTS} -jar /app/blade-api.jar --spring.profiles.active=${SPRING_PROFILE}"]