From c9c7823962a11194db32f739ecce90f08e3e6ce4 Mon Sep 17 00:00:00 2001 From: xiaozhou233 Date: Mon, 10 Aug 2026 18:43:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=20Dockerfile=20?= =?UTF-8?q?=E4=BB=A5=E6=94=AF=E6=8C=81=E6=9E=84=E5=BB=BA=E5=92=8C=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E5=BA=94=E7=94=A8=E7=A8=8B=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/.dockerignore | 7 +++++++ backend/Dockerfile | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 backend/.dockerignore create mode 100644 backend/Dockerfile diff --git a/backend/.dockerignore b/backend/.dockerignore new file mode 100644 index 0000000..05930ca --- /dev/null +++ b/backend/.dockerignore @@ -0,0 +1,7 @@ +.gradle +build/ +.idea +*.iml +bin/ +out/ +.vscode diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 0000000..58e85e7 --- /dev/null +++ b/backend/Dockerfile @@ -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"]