File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change 1
- name : Build
1
+ name : Containerize
2
2
3
3
on :
4
4
workflow_dispatch :
5
+ pull_request :
6
+ branches :
7
+ - " main"
5
8
push :
6
9
branches :
7
10
- " main"
Original file line number Diff line number Diff line change
1
+ FROM maven:3.9.8-eclipse-temurin-21-alpine AS builder
2
+
3
+ WORKDIR /app
4
+
5
+ COPY . .
6
+
7
+ RUN ./mvnw -B package
8
+
9
+ # Use an official OpenJDK runtime as a parent image
10
+ FROM amazoncorretto:21.0.4-alpine3.20
11
+
12
+ WORKDIR /app
13
+
14
+ # Add a non-root user
15
+ # RUN adduser --system --no-create-home --group spring && \
16
+ # chown -R spring:spring /app \
17
+ # && chmod -R 755 /app
18
+
19
+ # Set the working directory in the container
20
+
21
+ # Copy the application JAR file into the container at /app
22
+ COPY --from=builder /app/target/spring-petclinic-3.2.0-SNAPSHOT.jar spring-petclinic-3.2.0-SNAPSHOT.jar
23
+
24
+ # Make port 8080 available to the world outside this container
25
+ EXPOSE 8080
26
+
27
+ # Run the application
28
+ ENTRYPOINT ["java" , "-jar" , "spring-petclinic-3.2.0-SNAPSHOT.jar" ]
You can’t perform that action at this time.
0 commit comments