Skip to content

Commit

Permalink
health check commit
Browse files Browse the repository at this point in the history
  • Loading branch information
singsangssong committed Jan 7, 2025
1 parent 414c0b1 commit 3b7ab29
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# java 17버전으로 이미지 생성하기
FROM openjdk:17-jdk

# 디렉토리 생성 및 이동
WORKDIR /app

# Copy build artifact (JAR)
COPY build/libs/luty-server-0.0.1-SNAPSHOT.jar /app/app.jar

# Set environment variables
ENV JAVA_OPTS="-Dserver.port=8080"
ENV PORT=8080

# Expose the application port
EXPOSE 8080

# Command to run the application
ENTRYPOINT ["java", "-jar", "/app/app.jar"]
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ repositories {

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'

testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/com/luty/lutyserver/HealthController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.luty.lutyserver;

import lombok.NoArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@NoArgsConstructor
public class HealthController {
@GetMapping("/health")
public ResponseEntity<String> checkHealth() {
return ResponseEntity.ok("healthy!!");
}
}

0 comments on commit 3b7ab29

Please sign in to comment.