Skip to content
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

Migrate "study" dir to root #11

Open
wants to merge 2 commits into
base: development
Choose a base branch
from
Open

Migrate "study" dir to root #11

wants to merge 2 commits into from

Conversation

luckymagic7
Copy link
Contributor

  • add annotations to Dockerfile
  • add .dockerignore file to reduce docker build context
  • add README

#10

@luckymagic7 luckymagic7 self-assigned this Apr 24, 2019
@luckymagic7 luckymagic7 changed the title Migrate study dir to root Migrate "study" dir to root Apr 24, 2019
Jenkinsfile
tools
.git
.gitignore
Copy link
Contributor

Choose a reason for hiding this comment

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

크 .dockerignore 파일까지 챙기시다니.. 꼼꼼하시네요 👍

Dockerfile Outdated
@@ -1,19 +1,20 @@
# config-service-build stage
Copy link
Contributor

Choose a reason for hiding this comment

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

아래에 as config-service-build 로 stage 이름이 명시되어있어 해당 주석은 불필요해보입니다.

코드와 중복되는 의미를 갖는 주석은 유지보수시에 두번고쳐야하는 단점이 있습니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

오 그렇네요. 그럼 지우도록 하죠

Dockerfile Outdated
ADD pom.xml pom.xml
RUN mvn clean dependency:go-offline

ADD src src
RUN mvn -o package


# running stage
Copy link
Contributor

Choose a reason for hiding this comment

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

이 주석도 불필요해보입니다.

이보다 document 링크 주석이 더 올바르지 않나 생각됩니다.
https://docs.docker.com/develop/develop-images/multistage-build/

Copy link
Contributor

Choose a reason for hiding this comment

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

# Ref: https://docs.docker.com/develop/develop-images/multistage-build/

COPY --from=config-service-build /app/target/*.jar .

EXPOSE 8088

CMD java -jar *.jar
ENTRYPOINT ["sh", "-c"]
Copy link
Contributor

Choose a reason for hiding this comment

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

entrypoint 에 sh -c를 두는 이유가있나요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

기존 Dockerfile의 내용을 가져다 사용했습니다.
sh -c 를 쓰는 이유는 변수를 읽어들이기 위해 사용했었습니다.
뭐 현재는 필요없지만, 원본 Dockerfile의 경우

ENTRYPOINT ["sh", "-c"]
CMD ["exec java -jar $APP_FILE"]

이렇게 돼있어서 sh -c가 없다면 $APP_FILE을 변수로 대체하지 않고
그냥 java -jar $APP_FILE 명령으로 실행합니다. 그래서 에러가 나게 되고요.

docker: Error response from daemon: OCI runtime create failed: container_linux.go:345: starting container process caused "exec: \"java -jar $APP_FILE\": executable file not found in $PATH": unknown.

재영님이 jar파일을 변수명 처리 하지 않고 그냥 와일드카드로 줘서 굳이 필요 없긴 하지만, 놔뒀습니다.. ㅎ


CMD java -jar *.jar
ENTRYPOINT ["sh", "-c"]
CMD ["exec java -jar *.jar"]
Copy link
Contributor

Choose a reason for hiding this comment

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

exec 를 사용하는 이유가 있나요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

이것도 그냥 원본 갖다 쓴거 입니다.
이와 별개로 CMD에 재영님의 shell form(CMD java -jar *.jar) 을 사용하지 않고 exec form(CMD ["exec java -jar *.jar"])을 사용한 이유는 Docker 공식 레퍼런스에 그걸 추천한다고 되어 있어서 입니다.
image

README.md Outdated

- For java run(`Dockerfile`)
- To get the docker image, run:
`docker build -t tiny:tiny .`
Copy link
Contributor

Choose a reason for hiding this comment

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

tiny 라는 이름이 어디에서 나온것인가요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

naming은 그냥 작은거라서 tiny로 했습니다.
config-service 같은 걸로 고쳐야 겠네요.

@luckymagic7 luckymagic7 requested a review from kujyp April 26, 2019 02:42
- add annotations to Dockerfile
- add `.dockerignore` file to reduce docker build context
- add README
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants