paopao/Dockerfile

23 lines
447 B
Docker
Raw Normal View History

2024-06-04 08:14:10 +08:00
FROM gradle:8.0.0-jdk17 AS build
WORKDIR /app
# 将Gradle的配置文件复制到镜像中
COPY gradlew .
COPY build.gradle .
COPY settings.gradle .
COPY src src
# 构建应用
2024-06-04 08:58:29 +08:00
RUN ./gradlew bootJar
2024-06-04 08:14:10 +08:00
# 使用官方的Java运行时作为最终的运行环境
FROM openjdk:17-jdk-slim
WORKDIR /app
2024-06-04 08:28:50 +08:00
COPY --from=build /app/build/libs/*.jar app.jar
2024-06-04 08:14:10 +08:00
# 设置应用运行的端口
EXPOSE 8080
# 启动应用
ENTRYPOINT ["java","-jar","/app/app.jar"]