summaryrefslogtreecommitdiffhomepage
path: root/Dockerfile
diff options
context:
space:
mode:
Diffstat (limited to 'Dockerfile')
-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"]