部署文档

This commit is contained in:
石皮幼鸟 2024-07-14 08:58:12 +08:00
parent 764a788671
commit ce8fffa274
2 changed files with 36 additions and 0 deletions

14
Dockerfile Normal file
View File

@ -0,0 +1,14 @@
# 添加 Java 17 镜像来源
FROM openjdk:17
# springboot 端口
EXPOSE 3536
# 作者
LABEL maintainer="spyn <2960474346@qq.com>"
# 添加 Spring Boot 包
ADD target/takeaway-*.jar app.jar
# 执行启动命令
ENTRYPOINT ["java","-Duser.timezone=GMT+8","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]

22
initTakeawayBackend.sh Normal file
View File

@ -0,0 +1,22 @@
cd project || exit
# 如果已有文件目录,先删除
sudo rm -rf Takeaway
# 从Git上拉取代码
git clone http://1.14.105.160:9211/ethereal/TakeawaySystemServer.git
# 进入项目目录,打包
cd Takeaway/TakeawaySystemServer || exit
mvn clean package -Dmaven.test.skip=true
# 如果已有镜像或已启动容器,先删除
sudo docker stop takeaway
sudo docker rm takeaway
sudo docker rmi takeaway
# 构建镜像
sudo docker build -t takeaway .
# 启动容器
sudo docker run -d -p 3536:3536 --restart=always --name takeaway takeaway