Skip to content

feat: 도커파일 추가 #445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 23, 2024
Merged
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# 사용할 Java 버전 지정
FROM amazoncorretto:17
WORKDIR /app
VOLUME /tmp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R

/tmp 경로 말고 적절한 위치 없을까요?

linux의 /tmp 경로는 말 그대로 임시파일이 위치하는 경로입니다.
없어져도 무관한 경로라서 가끔 몇몇 OS에서는 system cron으로 30일 뒤에 공간을 비운다는 등의 작업을 수행한다고도 하네요

/usr/local 어딘가에 좋은 위치는 없을까요?

참고자료: https://coding-panda.com/%EB%A6%AC%EB%88%85%EC%8A%A4-%EC%A3%BC%EC%9A%94-%EB%94%94%EB%A0%89%ED%86%A0%EB%A6%AC-%EB%B3%84-%EC%97%AD%ED%95%A0-%EB%B0%8F-%EC%84%A4%EB%AA%85/#tmp

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

음 이미지는 빌드후 삭제시켜도 무방한 이미지라 tmp에 넣어두었는데, 그렇다면
그냥 생략해도 무방할것 같습니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그리고 tmp라고 저장할경우 실제 저장되는 위치는 var/lib/jenkins/workspace에서의 tmp가 위치입니다.
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

즉 따로 동기화할만한 데이터가 없으면 없애도 무방하다는 입장입니다

ADD ./build/libs/KOIN_API_V2.jar /app/app.jar
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C

COPY 말고 ADD를 사용한 이유가 있나요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

맞는 말씀입니다 Copy가 조금더 적합할것 같습니다!

ENTRYPOINT ["java", "-jar", "/app/app.jar"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A

어떤 역할을 하는지 간단하게 설명해주실 수 있을까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

흠 From은 이미지를 자바17로 돌린다는 소리고요
WorkDIR은 /app에 jar파일을 배포하겠다는 소리
Volume은 /tmp에 임시로 공간을 만든단 소리
ADD는 추후에 ci/cd로 빌드한 jar파일을 생성된 이미지로 옮긴다는 소리
EntryPoint는 java의 jar파일 위치가 되었겠습니다

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

설명 감사합니다 ㅎㅎ

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C

가독성을 위해 개행을 추가해주면 좋을 것 같아요

Suggested change
FROM amazoncorretto:17
WORKDIR /app
VOLUME /tmp
ADD ./build/libs/KOIN_API_V2.jar /app/app.jar
ENTRYPOINT ["java", "-jar", "/app/app.jar"]
FROM amazoncorretto:17
WORKDIR /app
VOLUME /tmp
ADD ./build/libs/KOIN_API_V2.jar /app/app.jar
ENTRYPOINT ["java", "-jar", "/app/app.jar"]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵 적용하겠습니다..!