add DockerFile and yml

This commit is contained in:
zhh
2025-10-28 15:28:52 +08:00
parent af8fbd90e3
commit 3608468374
2 changed files with 25 additions and 0 deletions

16
Dockerfile Normal file
View 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"]

9
docker-compose.yml Normal file
View File

@@ -0,0 +1,9 @@
services:
aida_back:
container_name: prod-lanecarford-back
build: .
volumes:
# 日志目录映射
- ./log:/log
ports:
- '10010:8080'