File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Expand file tree Collapse file tree 2 files changed +33
-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
+
8
+ RUN MAVEN_CONFIG="" ./mvnw -B package -DskipTests=true
9
+
10
+ # Use an official OpenJDK runtime as a parent image
11
+ FROM amazoncorretto:21.0.4-alpine3.20
12
+
13
+ WORKDIR /app
14
+
15
+ # Add a non-root user
16
+ # RUN adduser --system --no-create-home --group spring && \
17
+ # chown -R spring:spring /app \
18
+ # && chmod -R 755 /app
19
+
20
+ # Set the working directory in the container
21
+
22
+ # Copy the application JAR file into the container at /app
23
+ COPY --from=builder /app/target/spring-petclinic-3.2.0-SNAPSHOT.jar spring-petclinic-3.2.0-SNAPSHOT.jar
24
+
25
+ # Make port 8080 available to the world outside this container
26
+ EXPOSE 8080
27
+
28
+ # Run the application
29
+ ENTRYPOINT ["java" , "-jar" , "spring-petclinic-3.2.0-SNAPSHOT.jar" ]
You can’t perform that action at this time.
0 commit comments