summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2024-06-30 17:47:59 -0400
committerrealtradam <[email protected]>2024-06-30 17:47:59 -0400
commit94212c208e86e0b52bd08a105ea3a019704a64f0 (patch)
tree709ab74ed8bfe148737488e71e805214ba282e76
parent5b110d2317a931eeaf12fa4d23ee95a0172dcf43 (diff)
downloadspring-blog-94212c208e86e0b52bd08a105ea3a019704a64f0.tar.gz
spring-blog-94212c208e86e0b52bd08a105ea3a019704a64f0.zip
add Dockerfile to build appHEADmain
-rw-r--r--Dockerfile23
1 files changed, 23 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..4cf1caf
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,23 @@
+FROM eclipse-temurin:17.0.11_9-jdk-alpine as base
+
+# Make temporary build container
+From base as build
+COPY . .
+
+# Install packages needed to build
+RUN apk add --update --no-cache gradle
+
+# Build our app
+RUN gradle bootJar
+
+# Go back to our main container and copy over the build jar to it
+FROM base
+COPY --from=build build/libs/*.jar app.jar
+
+# Add user
+RUN addgroup -S spring && adduser -S spring -G spring && \
+ chown -R spring:spring app.jar
+USER spring:spring
+
+# Run the app
+ENTRYPOINT ["java","-jar","/app.jar"]