We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9640b7d commit bb67518Copy full SHA for bb67518
copilot-demo/Dockerfile
@@ -1 +1,19 @@
1
# Build a java application image based on openjdk 17 and run it on port 8080
2
+
3
+# Stage 1: Build the application
4
+FROM maven:3.9-eclipse-temurin-17 AS build
5
+WORKDIR /app
6
+COPY pom.xml .
7
+COPY src ./src
8
+RUN mvn clean package -DskipTests
9
10
+# Stage 2: Run the application
11
+FROM eclipse-temurin:17-jre
12
13
+COPY --from=build /app/target/*.jar app.jar
14
15
+# Create a non-root user and group, change ownership of /app, and switch to this user
16
+RUN addgroup --system javauser && adduser --system --ingroup javauser javauser && chown -R javauser:javauser /app
17
+USER javauser
18
+EXPOSE 8080
19
+ENTRYPOINT ["java", "-jar", "app.jar"]
0 commit comments