Skip to content

Commit 94943e0

Browse files
committed
.
1 parent d6b3f6d commit 94943e0

File tree

1 file changed

+6
-22
lines changed

1 file changed

+6
-22
lines changed
Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,13 @@
1-
# 第一阶段:使用 Maven 构建并打包
21
FROM maven:3.9.7-amazoncorretto-21 AS build
32
WORKDIR /t-io
3+
COPY pom.xml pom.xml
4+
COPY src src
5+
COPY script script
6+
RUN mvn package -q
47

5-
# 先复制 pom.xml,再复制源代码和脚本目录
6-
COPY pom.xml .
7-
COPY src ./src
8-
COPY script ./script
9-
10-
# 执行 package,会触发 maven-assembly-plugin 生成 target/tio-http-server-benchmark/ 目录,
11-
# 该目录下应包含一个可运行的 JAR(tio-http-server-benchmark.jar)和一个 config 子目录
12-
RUN mvn clean package -q
13-
14-
# 第二阶段:运行时镜像
15-
FROM openjdk:21-jdk-slim
16-
# 切换到与第一阶段输出目录对应的工作目录
8+
#TODO use separate JDK/JRE for the RUN (as the other builds)
179
WORKDIR /t-io/target/tio-http-server-benchmark
18-
COPY --from=maven /t-io/target/tio-http-server-benchmark/ ./
19-
20-
# 将第一阶段 build 中生成的整个目录复制过来,
21-
# 包含:
22-
# - tio-http-server-benchmark.jar
23-
# - config/ (静态配置等)
24-
COPY --from=build /t-io/target/tio-http-server-benchmark/ ./
2510

2611
EXPOSE 8080
2712

28-
# 使用 -cp 指定 JAR 与 config 目录,主类为 TioBenchmarkStarter
29-
CMD ["java", "-server", "-Xms1G", "-Xmx4G", "-cp", "tio-http-server-benchmark.jar:config", "org.tio.http.server.benchmark.TioBenchmarkStarter"]
13+
CMD ["java", "-server", "-Xms1G", "-Xmx4G", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-Dpacket.handler.mode=queue1", "-cp", "/t-io/target/tio-http-server-benchmark/config:/t-io/target/tio-http-server-benchmark/lib/*", "org.tio.http.server.benchmark.TioBenchmarkStarter"]

0 commit comments

Comments
 (0)