|
|
|
@ -70,21 +70,21 @@ public class PublishUtil {
|
|
|
|
|
ssh.mkdir(remotePath);
|
|
|
|
|
|
|
|
|
|
System.out.println("正在上传Dockerfile...");
|
|
|
|
|
ssh.upload(workingPath + "/Dockerfile", remotePath + "/Dockerfile");
|
|
|
|
|
ssh.upload(workingPath + "Dockerfile", remotePath + "Dockerfile");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!StrKit.isBlank(localLibPath)) {
|
|
|
|
|
System.out.println("正在创建lib目录...");
|
|
|
|
|
ssh.mkdir(remotePath + "/lib");
|
|
|
|
|
ssh.mkdir(remotePath + "lib");
|
|
|
|
|
//遍历lib目录下的文件
|
|
|
|
|
for (File file : FileUtil.loopFiles(localLibPath)) {
|
|
|
|
|
System.out.println("正在上传jar包:" + file.getName());
|
|
|
|
|
ssh.upload(file.getAbsolutePath(), remotePath + "/lib/" + file.getName());
|
|
|
|
|
ssh.upload(file.getAbsolutePath(), remotePath + "lib/" + file.getName());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!StrKit.isBlank(localStatic)) {
|
|
|
|
|
System.out.println("正在创建" + localStatic + "目录...");
|
|
|
|
|
ssh.mkdir(remotePath + "/" + localStatic);
|
|
|
|
|
ssh.mkdir(remotePath + localStatic);
|
|
|
|
|
//1、需要把目录压缩成ZIP文件
|
|
|
|
|
// 将目录打包成ZIP文件,不包含目录本身,只包含目录下的文件和子目录
|
|
|
|
|
String localFile = workingPath + localStatic + ".zip";
|
|
|
|
@ -92,7 +92,7 @@ public class PublishUtil {
|
|
|
|
|
ZipUtil.zip(workingPath + localStatic, localFile, true);
|
|
|
|
|
System.out.println("静态文件打包ZIP已完成,正在上传...");
|
|
|
|
|
//2、需要把ZIP文件上传
|
|
|
|
|
ssh.upload(localFile, remotePath + "/" + localStatic + ".zip");
|
|
|
|
|
ssh.upload(localFile, remotePath + localStatic + ".zip");
|
|
|
|
|
//3、把ZIP文件在远端解压缩
|
|
|
|
|
ssh.exec("cd " + remotePath + " && unzip " + localStatic + ".zip");
|
|
|
|
|
ssh.exec("cd " + remotePath + " && rm -rf " + localStatic + ".zip");
|
|
|
|
@ -102,7 +102,7 @@ public class PublishUtil {
|
|
|
|
|
if (!StrKit.isBlank(localNginxConf)) {
|
|
|
|
|
System.out.println("正在上传nginx.conf...");
|
|
|
|
|
File file = new File(localNginxConf);
|
|
|
|
|
ssh.upload(file.getAbsolutePath(), remotePath + "/" + file.getName());
|
|
|
|
|
ssh.upload(file.getAbsolutePath(), remotePath + file.getName());
|
|
|
|
|
System.out.println("成功完成上传文件nginx.conf");
|
|
|
|
|
}
|
|
|
|
|
//打包target为zip
|
|
|
|
|