Skip to content

Commit 4974d0d

Browse files
committed
on PR
1 parent e5c2cd5 commit 4974d0d

File tree

2 files changed

+32
-1
lines changed

2 files changed

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

0 commit comments

Comments
 (0)