File tree Expand file tree Collapse file tree 2 files changed +15
-21
lines changed Expand file tree Collapse file tree 2 files changed +15
-21
lines changed Original file line number Diff line number Diff line change 5959 - name : Checkout code
6060 uses : actions/checkout@v4
6161
62+ - name : Set up JDK 21
63+ uses : actions/setup-java@v3
64+ with :
65+ java-version : ' 21'
66+ distribution : ' temurin'
67+
68+ - name : Setup Gradle
69+ uses : gradle/gradle-build-action@v2
70+
71+ - name : Build with Gradle
72+ run : ./gradlew clean bootJar -x test --no-daemon
73+
6274 - name : Set environment
6375 id : env
6476 run : |
Original file line number Diff line number Diff line change 1- # Build stage
2- FROM gradle:8.5-jdk21 AS builder
3-
4- WORKDIR /app
5-
6- # Copy Gradle files
7- COPY build.gradle.kts settings.gradle.kts ./
8- COPY gradle gradle
9-
10- # Download dependencies
11- RUN gradle dependencies --no-daemon || true
12-
13- # Copy source code
14- COPY src ./src
15-
16- # Build application
17- RUN gradle clean build -x test --no-daemon
18-
19- # Runtime stage
1+ # Runtime stage only
202FROM eclipse-temurin:21-jre-alpine
213
224WORKDIR /app
@@ -31,8 +13,8 @@ ENV PG_TOSS_SECRET_KEY=${PG_TOSS_SECRET_KEY}
3113RUN addgroup -S spring && adduser -S spring -G spring
3214USER spring:spring
3315
34- # Copy built jar from builder
35- COPY --from=builder /app/ build/libs/* .jar app.jar
16+ # Copy pre- built jar from local build
17+ COPY build/libs/backend-0.0.1-SNAPSHOT .jar app.jar
3618
3719# Expose port
3820EXPOSE 8080
You can’t perform that action at this time.
0 commit comments