add DockerFile and yml
This commit is contained in:
16
Dockerfile
Normal file
16
Dockerfile
Normal file
@@ -0,0 +1,16 @@
|
||||
# ⭐️ 关键步骤:选择一个基于 JDK 21 的镜像
|
||||
# openjdk:21-jdk-slim 是一个较小的选择
|
||||
FROM openjdk:21-jdk-slim
|
||||
|
||||
# 设置工作目录
|
||||
WORKDIR /app
|
||||
|
||||
# 将构建好的 JAR 包添加到容器中
|
||||
# 假设你的 JAR 文件在 target/ 目录下,且命名为 app.jar
|
||||
COPY ./target/*.jar app.jar
|
||||
|
||||
# 暴露 Spring Boot 默认端口
|
||||
EXPOSE 8080
|
||||
|
||||
# 运行 JAR 文件。-Djava.security.egd=file:/dev/./urandom 用于提高随机数生成速度,在容器环境中推荐使用
|
||||
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/app/app.jar"]
|
||||
Reference in New Issue
Block a user