-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
34 lines (27 loc) · 1.28 KB
/
Dockerfile
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
# Simple Dockerfile adding Maven and GraalVM Native Image compiler to the standard
# 镜像版本号来自 graalvm 官网 https://github.com/graalvm/container/pkgs/container/graalvm-ce
FROM ghcr.io/graalvm/graalvm-ce:ol8-java17-22.2.0
ADD https://jenkins.goodcol.com/files/apache-maven-3.8.6.tar /tools/
ADD https://jenkins.goodcol.com/files/native-image-installable-svm-java17-linux-amd64-22.2.0.jar /tools/
COPY . /build
WORKDIR /tools
RUN set -x && \
tar -xvf apache-maven-*.tar && \
rm -rf apache-maven-*.tar && \
mv apache-maven-* maven && \
mv native-image-installable-*.jar native-image-installable.jar && \
export MAVEN_HOME=/tools/maven && \
export PATH=$PATH:$MAVEN_HOME/bin && \
gu -L install native-image-installable.jar && \
mvn --version && \
native-image --version && \
cd /build && \
mvn -Pnative clean package -DskipTests
# We use a Docker multi-stage build here in order to only take the compiled native Spring Boot App from the first build container
FROM oraclelinux:7-slim
MAINTAINER Shanhy
# Add Spring Boot Native app spring-boot-graal to Container
COPY --from=0 "/build/target/spring-native-demo" spring-native-demo
ENV PORT=8081
# Fire up our Spring Boot Native app by default
CMD [ "sh", "-c", "./spring-native-demo -Dserver.port=$PORT" ]