From 677462879ed522f1112ea7a03c2059f6482dd29a Mon Sep 17 00:00:00 2001 From: mukeshs Date: Fri, 10 Oct 2025 18:31:57 +0530 Subject: [PATCH] Image error solve update --- support-portal-backend/Dockerfile | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/support-portal-backend/Dockerfile b/support-portal-backend/Dockerfile index 48c3d71..bb87fa8 100644 --- a/support-portal-backend/Dockerfile +++ b/support-portal-backend/Dockerfile @@ -17,8 +17,9 @@ COPY src ./src # Build the application RUN mvn package -B -T 1C -DskipTests -Dmaven.javadoc.skip=true -# Verify the JAR was created -RUN ls -la target/ +# Verify the JAR was created and rename it to a consistent name +RUN ls -la target/ && \ + mv target/*.jar target/app.jar # ======================= # Runtime stage @@ -36,11 +37,12 @@ RUN mkdir -p /app && \ # Set working directory WORKDIR /app -# Copy the JAR from builder stage -COPY --from=builder /workdir/server/target/*.jar /app/ +# Copy the JAR with a consistent name +COPY --from=builder /workdir/server/target/app.jar /app/app.jar -# Create volume for uploads (optional but recommended) +# Create volume for uploads VOLUME ["/app/uploads"] -# Entry point: dynamically run the first JAR in /app -ENTRYPOINT ["sh", "-c", "java -jar /app/$(ls /app | grep .jar | head -n1)"] \ No newline at end of file +# Use exec form of ENTRYPOINT (not shell form) for proper signal handling +# and environment variable passing +ENTRYPOINT ["java", "-jar", "/app/app.jar"] \ No newline at end of file