Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Events
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
InvolutionHell
involutionhell-backend
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
involutionhell-backend
/
Dockerfile
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
37 lines (28 loc) · 1.38 KB
main
Breadcrumbs
involutionhell-backend
/
Dockerfile
Copy path
Top
File metadata and controls
Code
Blame
37 lines (28 loc) · 1.38 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
32
33
34
35
36
37
#
多阶段构建:第一阶段用 JDK 25 打 fat JAR
#
注:之前用 GraalVM native-image,但 @Cacheable 的 SpEL key 表达式在 native 模式下
#
反复触发 reflection hint 缺失导致容器启动失败(2026-04-14 起持续部署失败的根因)。
#
后端不跑在 serverless / edge 上,JVM 启动 ~5s 完全可接受,先切回 JVM 解阻塞。
#
后续若要重新切 native,需要补 RuntimeHints / @ImportRuntimeHints。
FROM
eclipse-temurin:25-jdk AS build
WORKDIR
/app
#
先复制 Maven Wrapper 和 pom.xml,利用 Docker 层缓存加速依赖下载
COPY
mvnw mvnw.cmd pom.xml ./
COPY
.mvn .mvn
RUN
chmod +x mvnw && ./mvnw dependency:go-offline -q
#
复制源码并打 JAR
COPY
src ./src
RUN
./mvnw -DskipTests package
#
第二阶段:最小化运行镜像
FROM
eclipse-temurin:25-jre
#
安装运行时依赖(curl 用于 healthcheck)
RUN
apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*
WORKDIR
/app
#
Spring Boot 默认产物 backend-*.jar,固定重命名为 backend.jar 方便 ENTRYPOINT
COPY
--from=build /app/target/backend-*.jar ./backend.jar
EXPOSE
8080
#
JVM 参数:容器感知内存、UTF-8 默认编码、GC 选 G1(默认即可,显式写出便于将来调)
ENTRYPOINT
[
"java"
, \
"-XX:+UseContainerSupport"
, \
"-XX:MaxRAMPercentage=75"
, \
"-Dfile.encoding=UTF-8"
, \
"-jar"
,
"backend.jar"
]
You can’t perform that action at this time.