Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
myspringweb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
황 재인
myspringweb
Commits
343351e7
Commit
343351e7
authored
1 month ago
by
황 재인
Browse files
Options
Downloads
Patches
Plain Diff
final
parent
1676d1f1
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#11571
failed
1 month ago
Stage: build
Stage: test
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Dockerfile
+26
-3
26 additions, 3 deletions
Dockerfile
docker-compose.yaml
+6
-2
6 additions, 2 deletions
docker-compose.yaml
src/main/java/com/ajou/procoding/myweb/service/MusicService.java
+0
-8
0 additions, 8 deletions
...n/java/com/ajou/procoding/myweb/service/MusicService.java
with
32 additions
and
13 deletions
Dockerfile
+
26
−
3
View file @
343351e7
FROM
openjdk:17-jdk
# 1단계: 빌드용 이미지
FROM
maven:3.9.6-eclipse-temurin-17
AS
builder
WORKDIR
/app
WORKDIR
/app
COPY
target/*.jar app.jar
# pom.xml과 소스 복사
COPY
pom.xml .
COPY
src ./src
# 의존성 캐시를 위한 별도 단계
RUN
mvn dependency:go-offline
# 애플리케이션 빌드
RUN
mvn clean package
-DskipTests
# 2단계: 실행용 이미지
FROM
eclipse-temurin:17-jdk
WORKDIR
/app
# 빌드된 JAR 복사
COPY
--from=builder /app/target/myweb-0.0.1-SNAPSHOT.jar app.jar
# 8080 포트 열기
EXPOSE
8080
EXPOSE
8080
# Spring Boot 앱 실행
ENTRYPOINT
["java", "-jar", "app.jar"]
ENTRYPOINT
["java", "-jar", "app.jar"]
This diff is collapsed.
Click to expand it.
docker-compose.yaml
+
6
−
2
View file @
343351e7
version
:
"
3.3"
version
:
'
3.8'
services
:
services
:
myweb
:
myweb
:
build
:
.
image
:
myweb
build
:
context
:
.
dockerfile
:
Dockerfile
ports
:
ports
:
-
"
8080:8080"
-
"
8080:8080"
This diff is collapsed.
Click to expand it.
src/main/java/com/ajou/procoding/myweb/service/MusicService.java
+
0
−
8
View file @
343351e7
...
@@ -23,8 +23,6 @@ public class MusicService {
...
@@ -23,8 +23,6 @@ public class MusicService {
private
final
FavoriteRepository
albumsRepo
;
private
final
FavoriteRepository
albumsRepo
;
private
final
RestTemplate
restTemplate
=
new
RestTemplate
();
private
final
RestTemplate
restTemplate
=
new
RestTemplate
();
//iTunes API를 호출해 앨범 검색 결과(MusicList) 반환
public
MusicList
searchMusic
(
String
name
)
{
public
MusicList
searchMusic
(
String
name
)
{
try
{
try
{
String
url
=
String
.
format
(
"https://itunes.apple.com/search?term=%s&entity=album"
,
name
);
String
url
=
String
.
format
(
"https://itunes.apple.com/search?term=%s&entity=album"
,
name
);
...
@@ -39,21 +37,15 @@ public class MusicService {
...
@@ -39,21 +37,15 @@ public class MusicService {
}
}
}
}
//DB에서 FavoriteMusic 목록을 조회
public
List
<
FavoriteMusic
>
getLikes
()
{
public
List
<
FavoriteMusic
>
getLikes
()
{
return
albumsRepo
.
findAll
();
return
albumsRepo
.
findAll
();
}
}
//즐겨찾기 등록
//DTO -> 엔티티 변환 후 DB에 저장, 성공 시 1, 실패 시 0 반환
public
int
saveFavorite
(
FavoriteMusicRequestDto
favorite
)
{
public
int
saveFavorite
(
FavoriteMusicRequestDto
favorite
)
{
FavoriteMusic
music
=
albumsRepo
.
save
(
favorite
.
toEntity
());
FavoriteMusic
music
=
albumsRepo
.
save
(
favorite
.
toEntity
());
return
(
music
!=
null
)
?
1
:
0
;
return
(
music
!=
null
)
?
1
:
0
;
}
}
// 존재하는지 확인 (없으면 예외 혹은 0 return 등)
public
int
deleteFavorite
(
String
id
)
{
public
int
deleteFavorite
(
String
id
)
{
try
{
try
{
if
(
albumsRepo
.
existsById
(
id
))
{
if
(
albumsRepo
.
existsById
(
id
))
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment