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