-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from UST-DeMAF/new-image
Using seperate build and deploy images
- Loading branch information
Showing
2 changed files
with
41 additions
and
13 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,24 @@ | ||
FROM alpine:latest | ||
# Stage 1: Build the application using Maven with Eclipse Temurin JDK 11 | ||
FROM maven:3.8.6-eclipse-temurin-11 AS build | ||
|
||
RUN apk upgrade --no-cache \ | ||
&& apk add --no-cache bash curl gcompat libstdc++ maven openjdk11 | ||
|
||
RUN mkdir -p /app/target | ||
# Set the working directory for the build stage | ||
WORKDIR /app | ||
|
||
# Copy the Maven project file and source code into the container | ||
COPY pom.xml . | ||
COPY src ./src | ||
|
||
RUN mvn clean package -DskipTests | ||
# Build the project, using multiple threads and skipping tests | ||
RUN mvn -T 2C -q clean package -DskipTests | ||
|
||
# Stage 2: Create a minimal runtime image using OpenJDK 11 JRE | ||
FROM openjdk:11-jre-slim | ||
|
||
# Set the working directory for the runtime stage | ||
WORKDIR /app | ||
|
||
# Copy all built files from the build stage to the runtime stage | ||
COPY --from=build /app /app | ||
|
||
CMD java -jar target/helm-plugin-0.0.1-SNAPSHOT.jar | ||
# Set the command to run the application | ||
CMD ["java", "-jar", "/app/target/helm-plugin-0.0.1-SNAPSHOT.jar"] |