-
Notifications
You must be signed in to change notification settings - Fork 9
/
Dockerfile.jvm
30 lines (22 loc) · 931 Bytes
/
Dockerfile.jvm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Use a specific version for reproducibility
FROM eclipse-temurin:23-jdk-alpine@sha256:62f73af9ec69cc3056ef92e2887b6398e23365d71bb06ff57d475f718e3f8723 AS build
# Set working directory
WORKDIR /usr/app
# Copy only the necessary files for dependency resolution
COPY gradlew gradlew
COPY gradle gradle
COPY build.gradle build.gradle
COPY settings.gradle settings.gradle
COPY src src
# Grant execution rights and build the application
RUN chmod +x ./gradlew && ./gradlew build --no-daemon
## Use a smaller JRE image for the runtime
FROM eclipse-temurin:23-jre-alpine@sha256:623a424ca41d6c4b78110af3a27e9efce9de40dacb2ee5a9f58c397c79a8e01f AS runtime
# Create the application directory
RUN mkdir /app
# Copy the JAR from the build stage
COPY --from=build /usr/app/build/libs/*.jar /app/app.jar
# Expose the application's port
EXPOSE 8080
# Define the command to run the application
ENTRYPOINT ["java", "-jar", "/app/app.jar"]