From 778bc878d23b74a7e545713d57216c1b8098463f Mon Sep 17 00:00:00 2001 From: zhao <70558837+fit2-zhao@users.noreply.github.com> Date: Fri, 6 Mar 2026 10:10:57 +0800 Subject: [PATCH] refactor: streamline Dockerfile and update startup script for application --- installer/Dockerfile | 33 ++++++-------------------------- installer/shells/start-cordys.sh | 4 +--- 2 files changed, 7 insertions(+), 30 deletions(-) diff --git a/installer/Dockerfile b/installer/Dockerfile index afdd0925a..a853606ab 100644 --- a/installer/Dockerfile +++ b/installer/Dockerfile @@ -1,42 +1,20 @@ -FROM --platform=${BUILDPLATFORM} node:22-slim AS frontend - -WORKDIR /frontend -COPY frontend /frontend -RUN npm install -g pnpm && \ - pnpm install && \ - pnpm run build - - -FROM eclipse-temurin:21-jdk AS build +FROM --platform=${BUILDPLATFORM} eclipse-temurin:21-jdk AS build WORKDIR /build COPY . /build -COPY --from=frontend /frontend/packages/web/dist /build/frontend/packages/web/dist -COPY --from=frontend /frontend/packages/mobile/dist /build/frontend/packages/mobile/dist -RUN ./mvnw clean package -DskipTests -pl '!frontend' && \ - mkdir backend/app/target/dependency && \ - cd backend/app/target/dependency && \ - jar -xf ../*.jar +RUN ./mvnw clean package -DskipTests FROM ghcr.io/cordys-dev/cordys-base:latest LABEL maintainer="FIT2CLOUD " ARG MODULE=app -ARG DEPENDENCY=/build/backend/${MODULE}/target/dependency -COPY --from=build ${DEPENDENCY}/BOOT-INF/lib /app/lib -COPY --from=build ${DEPENDENCY}/META-INF /app/META-INF -COPY --from=build ${DEPENDENCY}/BOOT-INF/classes /app -COPY --from=build /build/backend/${MODULE}/src/main/resources/static /app/static +COPY --from=build /build/backend/${MODULE}/target/app-main.jar /app/cordys-crm.jar COPY installer/shells /shells COPY installer/conf /installer/conf - COPY installer/mcp /app/mcp -ENV JAVA_CLASSPATH=/app:/app/lib/* -ENV JAVA_MAIN_CLASS=cn.cordys.Application -ENV AB_OFF=true ENV JAVA_OPTIONS="-Dfile.encoding=utf-8 -Djava.awt.headless=true --add-opens java.base/jdk.internal.loader=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED" ARG CRM_VERSION=main @@ -49,5 +27,6 @@ VOLUME [ "/opt/cordys" ] EXPOSE 8081 8082 3306 -RUN chmod 777 /shells/*.sh -ENTRYPOINT ["sh", "/shells/start-all.sh"] +RUN chmod 777 /shells/*.sh + +ENTRYPOINT ["sh", "/shells/start-all.sh"] \ No newline at end of file diff --git a/installer/shells/start-cordys.sh b/installer/shells/start-cordys.sh index 438cd92a6..063996659 100644 --- a/installer/shells/start-cordys.sh +++ b/installer/shells/start-cordys.sh @@ -2,8 +2,6 @@ bash /shells/init-directories.sh -export JAVA_CLASSPATH=/app:/app/lib/* -export JAVA_MAIN_CLASS=cn.cordys.Application export CRM_VERSION=`cat /tmp/CRM_VERSION` -sh /deployments/run-java.sh \ No newline at end of file +exec java ${JAVA_OPTIONS} -jar /app/cordys-crm.jar \ No newline at end of file