Created
September 19, 2024 06:22
-
-
Save taufiqpsumarna/125c7fd2ad58e2aee3decdd01991864a to your computer and use it in GitHub Desktop.
Lightweight Docker Image Java Apps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Stage 1: Build the application | |
FROM maven:3.9-eclipse-temurin-17-alpine AS build | |
WORKDIR /build | |
COPY . . | |
RUN mvn package | |
#Stage 2: Create the final lightweight image | |
FROM eclipse-temurin:17-jre-alpine | |
WORKDIR /app | |
COPY --from=build /build/target/hello-world.jar . | |
ENTRYPOINT ["java","-jar","hello-world.jar"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment