Skip to content

Commit

Permalink
Merge pull request #12 from skkuse/backend-docker
Browse files Browse the repository at this point in the history
Backend docker
  • Loading branch information
jet981217 authored Dec 12, 2023
2 parents 1b40328 + 761c340 commit d6a9208
Show file tree
Hide file tree
Showing 18 changed files with 61 additions and 2 deletions.
Binary file added .DS_Store
Binary file not shown.
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"java.compile.nullAnalysis.mode": "automatic",
"java.configuration.updateBuildConfiguration": "interactive"
}
Binary file added backend/.DS_Store
Binary file not shown.
22 changes: 22 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Set base image to Ubuntu
FROM ubuntu:latest

# Install OpenJDK 17
RUN apt-get update && \
apt-get install -y openjdk-17-jdk && \
apt-get clean;

# Set the working directory in the container
WORKDIR /usr/src/app

# Copy the current directory contents to the container at /usr/src/app
COPY . /usr/src/app

# Expose port 8000
EXPOSE 8080

# Start the Java application
CMD ["java", "-jar", "/usr/src/app/build/libs/se7-0.0.1-SNAPSHOT.jar"]

# If you want to keep the container running uncomment the following line
#CMD tail -f /dev/null
3 changes: 1 addition & 2 deletions backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ ext {
}

test {
outputs.dir snippetsDir
useJUnitPlatform()
enabled = false
}

asciidoctor {
Expand Down
Empty file modified backend/gradlew
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions backend/src/main/java/com/skku/se7/Se7Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ public void addCorsMappings(CorsRegistry registry) {
};
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
@Slf4j
@RestController
@RequiredArgsConstructor
@CrossOrigin(origins="*")
public class GreenController {
private final GreenService greenService;
private final ProcessorTdpHandler processorTdpHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
import com.skku.se7.service.dataHandler.ProcessorTdpHandler;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequiredArgsConstructor
@CrossOrigin(origins="*")
public class ViewController {
private final ProcessorTdpHandler processorTdpHandler;
private final LocationHandler locationHandler;
Expand Down
Binary file added bin/com/skku/se7/Se7Application.class
Binary file not shown.
Binary file added bin/com/skku/se7/Se7ApplicationTests.class
Binary file not shown.
Binary file added bin/com/skku/se7/controller/HelloController.class
Binary file not shown.
Binary file added bin/com/skku/se7/service/HelloService.class
Binary file not shown.
Binary file added bin/com/skku/se7/service/JavaCodeCompiler.class
Binary file not shown.
Binary file added bin/com/skku/se7/service/JavaRunner.class
Binary file not shown.
Binary file added bin/com/skku/se7/service/ResourceProcessor.class
Binary file not shown.
Binary file added bin/com/skku/se7/service/ViolationChecker.class
Binary file not shown.
29 changes: 29 additions & 0 deletions frontend/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>HTTP GET 요청 예제</title>
</head>
<body>
<h1>서버 응답:</h1>
<div id="response"></div>

<script>
// 서버에서 데이터를 가져오는 함수
function fetchData() {
fetch('http://ec2-3-35-3-126.ap-northeast-2.compute.amazonaws.com:8080/model/cpu')
.then(response => response.text())
.then(data => {
// 응답을 HTML 요소에 표시
document.getElementById('response').innerText = data;
})
.catch(error => {
console.error('요청 중 오류 발생:', error);
});
}

// 페이지가 로드될 때 함수 실행
window.onload = fetchData;
</script>
</body>
</html>

0 comments on commit d6a9208

Please sign in to comment.