-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (23 loc) · 869 Bytes
/
Copy pathDockerfile
File metadata and controls
31 lines (23 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# ============================================================
# KnowEngine Dockerfile
# ============================================================
FROM eclipse-temurin:21-jdk-alpine
# 设置工作目录
WORKDIR /app
# 安装必要工具
RUN apk add --no-cache tzdata curl
# 设置时区
ENV TZ=Asia/Shanghai
RUN ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# 复制 Maven 构建的 JAR 文件
# 先构建: mvn clean package -DskipTests
COPY target/know-engine-1.0.0-SNAPSHOT.jar app.jar
# 暴露端口
EXPOSE 8009
# JVM 参数
ENV JAVA_OPTS="-Xms512m -Xmx1024m -XX:+UseG1GC -XX:+HeapDumpOnOutOfMemoryError"
# 健康检查
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:8009/actuator/health || exit 1
# 启动应用
ENTRYPOINT ["sh", "-c", "java $JAVA_OPTS -jar app.jar"]