Skip to content

Commit 3b26872

Browse files
committed
fix: 设置 TMPDIR=/app/tmp 绕过 buildkit 容器 /tmp noexec 限制
1 parent 371677b commit 3b26872

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ RUN chmod +x mvnw && ./mvnw dependency:go-offline -q
1111

1212
# 复制源码并编译 Native Image
1313
COPY src ./src
14-
# -Pnative package 会触发 Spring Boot AOT 处理(process-aot)再进行 native-image 编译
15-
# 直接调用 native:compile / native:compile-no-fork 会跳过 AOT 阶段,导致找不到主类
16-
RUN ./mvnw -DskipTests -Pnative package
14+
# GitHub Actions buildkit 容器中 /tmp 以 noexec 挂载,GraalVM 需要在 /tmp 执行 C 辅助程序
15+
# 将 TMPDIR 指向有执行权限的目录解决此问题
16+
RUN mkdir -p /app/tmp && TMPDIR=/app/tmp ./mvnw -DskipTests -Pnative package
1717

1818
# 第二阶段:最小化运行镜像
1919
FROM ubuntu:24.04

0 commit comments

Comments
 (0)