Skip to content

jun9ho/hello-rest-api

Repository files navigation

hello-rest-api

Test

$ curl http://localhost:8080/hello | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   115  100   115    0     0   1251      0 --:--:-- --:--:-- --:--:--  1263
{
  "timestamp": 1760236794196,
  "message": "Hello, World!",
  "koreaTime": "2025-10-12T11:39:54.196921463+09:00[Asia/Seoul]"
}
image

Build

$ ./gradlew clean bootJar

Run

$ java -jar build/lib/hello-rest=api-<VERSION>.jar

Remote Run

# scp -i <KEY.pem> start.sh ubuntu@<SERVER_IP>:~/app/spring-rest-api

$ ssh -i <KEY.pem> ubuntu@<SERVER_IP> \
"cd /home/ubuntu/app/spring-rest-api;pwd;./start.sh"

Remote Stop

# scp -i <KEY.pem> stop.sh ubuntu@<SERVER_IP>:~/app/spring-rest-api

$ ssh -i <KEY.pem> ubuntu@<SERVER_IP> \
"cd /home/ubuntu/app/spring-rest-api;pwd;./stop.sh"

Dockerizing

# 빌드
$ ./gradlew clean bootJar
$ sudo docker build --build-arg JAR_FILE=build/libs/\*.jar \
-t datamario24/spring-rest-api:0.3.0 .

# Run
# sudo docker run -d -p 8030:8080 --name srq030 datamario24/spring-rest-api:0.3.0

$ sudo docker images | grep spring-rest-api
datamario24/spring-rest-api   0.3.0           df8b2c938eac   43 seconds ago   347MB

$ sudo docker push datamario24/spring-rest-api:0.3.0



$ sudo docker status

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published