-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (27 loc) · 744 Bytes
/
Dockerfile
File metadata and controls
36 lines (27 loc) · 744 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# ======================
# 1. Build Stage
# ======================
FROM registry.access.redhat.com/ubi8/openjdk-17 as build
# Set workdir
RUN mkdir hello
WORKDIR /home/jboss/hello
# Copy pom.xml and download dependencies
COPY pom.xml .
RUN mvn dependency:go-offline
# Copy source and build
COPY src ./src
RUN mvn clean package -DskipTests
# ======================
# 2. Runtime Stage
# ======================
FROM registry.access.redhat.com/ubi8/openjdk-17-runtime
# Set non-root user for OpenShift compatibility
USER 1001
# Set working dir
WORKDIR /deployments
# Copy the built jar
COPY --from=build /home/jboss/hello/target/*.jar app.jar
# Expose Spring Boot default port
EXPOSE 8080
# Run app
ENTRYPOINT ["java", "-jar", "app.jar"]