File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# ---- Stage 1: Build the application ----
22FROM eclipse-temurin:24-jdk AS builder
3-
4- # Set working directory inside container
53WORKDIR /app
64
7- # Copy Gradle wrapper and configuration first to leverage Docker cache
8- COPY gradlew gradlew
9- COPY gradle gradle
10- COPY build.gradle* .
11- COPY settings.gradle* .
5+ COPY gradlew .
6+ COPY gradle gradle/
7+ COPY build.gradle .
8+ COPY settings.gradle .
129
13- # Pre-download Gradle dependencies to prevent timeouts later
14- RUN chmod +x gradlew && ./gradlew --no-daemon build -x test || true
10+ # Download dependencies (for caching)
11+ RUN chmod +x gradlew && ./gradlew --no-daemon dependencies
1512
16- # Now copy the full project
13+ # Copy full project source
1714COPY . .
1815
19- # Build the application (will reuse downloaded Gradle distribution)
20- RUN ./gradlew clean build -x test - -no-daemon
16+ # Build application and run tests
17+ RUN ./gradlew clean build --no-daemon
2118
2219# ---- Stage 2: Create a minimal runtime image ----
2320FROM eclipse-temurin:24-jre
24-
25- # Set working directory
2621WORKDIR /app
2722
28- # Copy built JAR from the builder stage
23+ # Copy built JAR from builder stage
2924COPY --from=builder /app/build/libs/*.jar app.jar
3025
31- # Expose the port your service runs on
3226EXPOSE 8083
3327
34- # Run the JAR
35- ENTRYPOINT ["java" , "-jar" , "app.jar" ]
28+ ENTRYPOINT ["java" , "-jar" , "app.jar" ]
Original file line number Diff line number Diff line change 11# ---- Stage 1: Build the application ----
22FROM eclipse-temurin:24-jdk AS builder
3-
4- # Set working directory inside container
53WORKDIR /app
64
7- # Copy Gradle wrapper and configuration first to leverage Docker cache
8- COPY gradlew gradlew
9- COPY gradle gradle
10- COPY build.gradle* .
11- COPY settings.gradle* .
5+ COPY gradlew .
6+ COPY gradle gradle/
7+ COPY build.gradle .
8+ COPY settings.gradle .
129
13- # Pre-download Gradle dependencies to prevent timeouts later
14- RUN chmod +x gradlew && ./gradlew --no-daemon build -x test || true
10+ # Download dependencies (for caching)
11+ RUN chmod +x gradlew && ./gradlew --no-daemon dependencies
1512
16- # Now copy the full project
13+ # Copy full project source
1714COPY . .
1815
19- # Clean + build the JAR without running tests
20- RUN ./gradlew clean build -x test - -no-daemon
16+ # Build application and run tests
17+ RUN ./gradlew clean build --no-daemon
2118
2219# ---- Stage 2: Create a minimal runtime image ----
2320FROM eclipse-temurin:24-jre
24-
25- # Set working directory
2621WORKDIR /app
2722
28- # Copy built JAR from the builder stage
23+ # Copy built JAR from builder stage
2924COPY --from=builder /app/build/libs/*.jar app.jar
3025
3126EXPOSE 8082
32- ENTRYPOINT ["java" , "-jar" , "app.jar" ]
27+ ENTRYPOINT ["java" , "-jar" , "app.jar" ]
Original file line number Diff line number Diff line change 11# ---- Stage 1: Build the application ----
22FROM eclipse-temurin:24-jdk AS builder
3-
4- # Set working directory inside container
53WORKDIR /app
64
7- # Copy Gradle wrapper and configuration first to leverage Docker cache
8- COPY gradlew gradlew
9- COPY gradle gradle
10- COPY build.gradle* .
11- COPY settings.gradle* .
5+ COPY gradlew .
6+ COPY gradle gradle/
7+ COPY build.gradle .
8+ COPY settings.gradle .
129
13- # Pre-download Gradle dependencies to prevent timeouts later
14- RUN chmod +x gradlew && ./gradlew --no-daemon build -x test || true
10+ # Download dependencies (for caching)
11+ RUN chmod +x gradlew && ./gradlew --no-daemon dependencies
1512
16- # Now copy the full project
13+ # Copy full project source
1714COPY . .
1815
19- # Build the application (will reuse downloaded Gradle distribution)
20- RUN ./gradlew clean build -x test - -no-daemon
16+ # Build application and run tests
17+ RUN ./gradlew clean build --no-daemon
2118
2219# ---- Stage 2: Create a minimal runtime image ----
2320FROM eclipse-temurin:24-jre
24-
25- # Set working directory
2621WORKDIR /app
2722
28- # Copy built JAR from the builder stage
23+ # Copy built JAR from builder stage
2924COPY --from=builder /app/build/libs/*.jar app.jar
3025
31- # Expose the service port
3226EXPOSE 8081
3327
34- # Run the application
35- ENTRYPOINT ["java" , "-jar" , "app.jar" ]
28+ ENTRYPOINT ["java" , "-jar" , "app.jar" ]
You can’t perform that action at this time.
0 commit comments