-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
27 lines (21 loc) · 894 Bytes
/
Dockerfile
File metadata and controls
27 lines (21 loc) · 894 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
FROM maven:3.9.8-amazoncorretto-21-al2023 as stage1
ENV MAVEN_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
# set working directory
WORKDIR /opt/demo
# copy just pom.xml
COPY pom.xml .
# go-offline using the pom.xml
RUN mvn dependency:go-offline
# copy your other files
COPY ./src ./src
# compile the source code and package it in a jar file
RUN mvn clean install -Dmaven.test.skip=true
FROM bellsoft/liberica-openjdk-centos:21-cds
WORKDIR /opt/demo
# copy over the built artifact from the maven image
COPY --from=stage1 /opt/demo/target/web-0.0.1-SNAPSHOT.jar /opt/demo/web-0.0.1-SNAPSHOT.jar
EXPOSE 8080
LABEL org.opencontainers.image.source=https://github.com/anastasiosbroadcom/spring-boot-starter-web
LABEL org.opencontainers.image.description="Spring boot web example"
LABEL org.opencontainers.image.licenses=MIT
ENTRYPOINT ["java","-jar","/opt/demo/web-0.0.1-SNAPSHOT.jar"]