Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
backend
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
idatt2106-v23-03
backend
Commits
ea030a3c
Commit
ea030a3c
authored
1 year ago
by
Stian Lyng Stræte
Browse files
Options
Downloads
Patches
Plain Diff
Make dockerfile robust
parent
6fe86e25
Branches
217-add-algotihm-to-find-relevant-statistics
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Dockerfile
+25
-5
25 additions, 5 deletions
Dockerfile
with
25 additions
and
5 deletions
Dockerfile
+
25
−
5
View file @
ea030a3c
FROM
eclipse-temurin:19-jdk-alpine
COPY
. .
VOLUME
/tmp
# Use a specific version of the JDK image to ensure consistency
FROM
eclipse-temurin:19-jdk-alpine
AS
build
# Set the working directory
WORKDIR
/app
# Copy the pom.xml file first, and then download dependencies separately to take advantage of Docker layer caching
COPY
pom.xml .
RUN
apk add maven
RUN
mvn dependency:go-offline
# Copy the source code and package the application
COPY
src ./src
RUN
mvn clean package
ENTRYPOINT
["java","-jar","target/SmartMat-0.0.1-SNAPSHOT.jar"]
EXPOSE
8080
\ No newline at end of file
# 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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment