This commit is contained in:
huchuansai
2025-06-12 13:10:49 +08:00
parent d5a51faf8b
commit da9771cb9d
4 changed files with 28 additions and 247 deletions

16
docker/Dockerfile Normal file
View File

@@ -0,0 +1,16 @@
FROM openjdk:11-jre-slim
# 设置工作目录
WORKDIR /app
# 只复制应用程序JAR包不复制lib目录
COPY ./*.jar app.jar
# 设置环境变量
ENV APP_NAME=app.jar
# 暴露应用端口
EXPOSE 8080
# 设置启动命令
CMD ["sh", "-c", "java -Dloader.path=./lib/ -Xms2g -Xmx2g -jar $APP_NAME --spring.profiles.active=test"]

12
docker/docker-compose.yml Normal file
View File

@@ -0,0 +1,12 @@
version: '3'
services:
spring-boot-app:
build: .
container_name: spring-boot-app
ports:
- "7003:7002"
volumes:
- ./lib:/app/lib # 挂载主机的lib目录到容器内的lib目录
- ./log:/app/log # 挂载日志目录到主机
restart: always