feat: 添加 Dockerfile 以支持构建和运行应用程序
This commit is contained in:
1 parent
e541a529d4
commit
c9c7823962
2 files changed
+24
No files matched your search
@@ -0,0 +1,7 @@
|
||||
.gradle
|
||||
build/
|
||||
.idea
|
||||
*.iml
|
||||
bin/
|
||||
out/
|
||||
.vscode
|
||||
@@ -0,0 +1,17 @@
|
||||
# ---- 构建阶段 ----
|
||||
FROM gradle:9.5.1-jdk17 AS build
|
||||
WORKDIR /workspace
|
||||
|
||||
COPY . .
|
||||
RUN gradle bootJar --no-daemon
|
||||
|
||||
# ---- 运行阶段 ----
|
||||
FROM eclipse-temurin:17-jre
|
||||
WORKDIR /app
|
||||
|
||||
RUN groupadd --system app && useradd --system --gid app app
|
||||
COPY --from=build /workspace/build/libs/*.jar /app/server.jar
|
||||
USER app
|
||||
|
||||
EXPOSE 9018
|
||||
ENTRYPOINT ["java", "-jar", "/app/server.jar"]
|
||||
Reference in new issue
Block a user