Skip to content

Commit ea9bfcf

Browse files
committed
on PR
1 parent e5c2cd5 commit ea9bfcf

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

.github/workflows/container.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
name: Build
1+
name: Containerize
22

33
on:
44
workflow_dispatch:
5+
pull_request:
6+
branches:
7+
- "main"
58
push:
69
branches:
710
- "main"

Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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"]

0 commit comments

Comments
 (0)