栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

spring native 通过dockerfile 构建镜像

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

spring native 通过dockerfile 构建镜像

dockerfile

# Simple Dockerfile adding Maven and GraalVM Native Image compiler to the standard
# https://github.com/graalvm/container/pkgs/container/graalvm-ce image
#FROM ghcr.io/graalvm/graalvm-ce:ol7-java11-21.2.0
#FROM appvance/graalvm-11
FROM softinstigate/graalvm-maven

ADD . /build
WORKDIR /build

# For SDKMAN to work we need unzip & zip
#RUN yum install -y unzip zip

#RUN 
    # Install GraalVM Native Image
    #gu install native-image;
RUN  chmod 777 ./mvnw
RUN  export JAVA_HOME=/usr/lib/graalvm-ce-java11-21.1.0/
RUN  export PATH=$PATH:$JAVA_HOME/bin
RUN  mvn -version
#RUN  ../mvnw -version

RUN native-image --version

#RUN  mvn -B clean package -P native --no-transfer-progress
RUN  mvn clean package -P native --no-transfer-progress


# We use a Docker multi-stage build here in order that we only take the compiled native Spring Boot App from the first build container
FROM oraclelinux:7-slim

MAINTAINER Jonas Hecht

# Add Spring Boot Native app spring-boot-graal to Container
COPY --from=0 "/build/target/nativedemo" nativedemo

# Fire up our Spring Boot Native app by default
CMD [ "sh", "-c", "./spring-boot-graal -Dserver.port=$PORT" ]

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/981008.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号