prod
This commit is contained in:
20
Dockerfile
Normal file
20
Dockerfile
Normal file
@@ -0,0 +1,20 @@
|
||||
# Stage 1: Build stage (gradle build는 Jenkins에서 이미 수행)
|
||||
FROM eclipse-temurin:21-jre-jammy
|
||||
|
||||
# docker CLI 설치 (컨테이너에서 호스트 Docker 제어용) 260212 추가
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends docker.io ca-certificates && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 작업 디렉토리 설정
|
||||
WORKDIR /app
|
||||
|
||||
# JAR 파일 복사 (Jenkins에서 빌드된 ROOT.jar)
|
||||
COPY build/libs/ROOT.jar app.jar
|
||||
|
||||
# 포트 노출
|
||||
EXPOSE 8080
|
||||
|
||||
# 애플리케이션 실행
|
||||
# dev 프로파일로 실행
|
||||
ENTRYPOINT ["java", "-jar", "-Dspring.profiles.active=prod", "app.jar"]
|
||||
@@ -787,92 +787,6 @@ public class FIleChecker {
|
||||
return destFile;
|
||||
}
|
||||
|
||||
public static void uploadTo86(Path localFile) {
|
||||
|
||||
String host = "192.168.2.86";
|
||||
int port = 22;
|
||||
String username = "kcomu";
|
||||
String password = "Kamco2025!";
|
||||
|
||||
String remoteDir = "/home/kcomu/data/request";
|
||||
|
||||
Session session = null;
|
||||
ChannelSftp channel = null;
|
||||
|
||||
try {
|
||||
JSch jsch = new JSch();
|
||||
|
||||
session = jsch.getSession(username, host, port);
|
||||
session.setPassword(password);
|
||||
|
||||
Properties config = new Properties();
|
||||
config.put("StrictHostKeyChecking", "no");
|
||||
session.setConfig(config);
|
||||
|
||||
session.connect(10_000);
|
||||
|
||||
channel = (ChannelSftp) session.openChannel("sftp");
|
||||
channel.connect(10_000);
|
||||
|
||||
// 목적지 디렉토리 이동
|
||||
channel.cd(remoteDir);
|
||||
|
||||
// 업로드
|
||||
channel.put(localFile.toString(), localFile.getFileName().toString());
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("SFTP upload failed", e);
|
||||
} finally {
|
||||
if (channel != null) channel.disconnect();
|
||||
if (session != null) session.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
public static void unzipOn86Server(String zipPath, String targetDir) {
|
||||
|
||||
String host = "192.168.2.86";
|
||||
String user = "kcomu";
|
||||
String password = "Kamco2025!";
|
||||
|
||||
Session session = null;
|
||||
ChannelExec channel = null;
|
||||
|
||||
try {
|
||||
JSch jsch = new JSch();
|
||||
|
||||
session = jsch.getSession(user, host, 22);
|
||||
session.setPassword(password);
|
||||
|
||||
Properties config = new Properties();
|
||||
config.put("StrictHostKeyChecking", "no");
|
||||
session.setConfig(config);
|
||||
|
||||
session.connect(10_000);
|
||||
|
||||
String command = "unzip -o " + zipPath + " -d " + targetDir;
|
||||
|
||||
channel = (ChannelExec) session.openChannel("exec");
|
||||
channel.setCommand(command);
|
||||
channel.setErrStream(System.err);
|
||||
|
||||
InputStream in = channel.getInputStream();
|
||||
channel.connect();
|
||||
|
||||
// 출력 읽기(선택)
|
||||
try (BufferedReader br = new BufferedReader(new InputStreamReader(in))) {
|
||||
while (br.readLine() != null) {
|
||||
// 필요하면 로그
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
if (channel != null) channel.disconnect();
|
||||
if (session != null) session.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
public static List<String> execCommandAndReadLines(String command) {
|
||||
|
||||
List<String> result = new ArrayList<>();
|
||||
|
||||
@@ -398,23 +398,7 @@ public class DatasetService {
|
||||
return datasetCoreService.getFilePathByUUIDPathType(uuid, pathType);
|
||||
}
|
||||
|
||||
private String readRemoteFileAsString(String remoteFilePath) {
|
||||
|
||||
String command = "cat " + escape(remoteFilePath);
|
||||
|
||||
List<String> lines = FIleChecker.execCommandAndReadLines(command);
|
||||
|
||||
return String.join("\n", lines);
|
||||
}
|
||||
|
||||
private JsonNode parseJson(String json) {
|
||||
try {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
return mapper.readTree(json);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("JSON 파싱 실패", e);
|
||||
}
|
||||
}
|
||||
|
||||
private String escape(String path) {
|
||||
return "'" + path.replace("'", "'\"'\"'") + "'";
|
||||
|
||||
@@ -15,7 +15,7 @@ spring:
|
||||
format_sql: true # ⚠️ 선택 - SQL 포맷팅 (가독성)
|
||||
|
||||
datasource:
|
||||
url: jdbc:postgresql://127.0.01:15432/kamco_training_db
|
||||
url: jdbc:postgresql://kamco-cd-train-db:5432/kamco_training_db
|
||||
# url: jdbc:postgresql://localhost:15432/kamco_training_db
|
||||
username: kamco_training_user
|
||||
password: kamco_training_user_2025_!@#
|
||||
|
||||
Reference in New Issue
Block a user