Skip to content
Snippets Groups Projects
Commit 620ad55d authored by Stian Lyng Stræte's avatar Stian Lyng Stræte
Browse files

Update Dockerfile

parent 7d109b08
No related branches found
No related tags found
No related merge requests found
## Use a specific version of the JDK image to ensure consistency # Use a specific version of the JDK image to ensure consistency
#FROM eclipse-temurin:19-jdk-alpine AS build FROM eclipse-temurin:19-jdk-alpine AS build
#
## Set the working directory # Set the working directory
#WORKDIR /app WORKDIR /app
#
## Copy the pom.xml file first, and then download dependencies separately to take advantage of Docker layer caching # Copy the pom.xml file first, and then download dependencies separately to take advantage of Docker layer caching
#COPY pom.xml . COPY pom.xml .
#RUN apk add maven RUN apk add maven
#RUN mvn dependency:go-offline RUN mvn dependency:go-offline
#
## Copy the source code and package the application # Copy the source code and package the application
#COPY src ./src COPY src ./src
#RUN mvn clean package RUN mvn clean package
#
## Use a new stage to reduce the final image size # Use a new stage to reduce the final image size
#FROM eclipse-temurin:19-jre-alpine
#
## Set the working directory
#WORKDIR /app
#
## Copy the packaged application from the build stage
#COPY --from=build /app/target/SmartMat-0.0.1-SNAPSHOT.jar ./SmartMat.jar
#
## Define the entrypoint and expose the application port
#ENTRYPOINT ["java","-jar","SmartMat.jar"]
#EXPOSE 8080
#
# Use the Eclipse Temurin JRE 19 image as the base image
FROM eclipse-temurin:19-jre-alpine FROM eclipse-temurin:19-jre-alpine
# Set the working directory # Set the working directory
WORKDIR /app WORKDIR /app
# Copy the JAR file to the working directory # Copy the packaged application from the build stage
COPY my-jar-file.jar ./app.jar COPY --from=build /app/target/SmartMat-0.0.1-SNAPSHOT.jar ./SmartMat.jar
# Expose the port the application will run on # Define the entrypoint and expose the application port
ENTRYPOINT ["java","-jar","SmartMat.jar"]
EXPOSE 8080 EXPOSE 8080
# Run the application
CMD ["java", "-jar", "app.jar"]
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment