-
Notifications
You must be signed in to change notification settings - Fork 20
feat : 컨테이너 테스트 환경 구축을 위한 docker-compose 작성 #887
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
Conversation
Test Results Summary 46 files 46 suites 14s ⏱️ Results for commit d59e32d. ♻️ This comment has been updated with latest results. |
Migration Result 📦
Schema Validation Result 🔍✅ No schema mismatches detected. Results for commit ♻️ This comment has been updated with latest results. |
pstar987
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다. 일단 민감정보제외는 필수가 되도록 수정해주셔야할 것 같습니다. 그리고 application.yml의 경로가 /app/src/main 인 부분은 이제 없어도 되지 않나요?
노션을 확인해봤을때도 추후에 어디에 어떻게 발전해나가면 좋을 지 등에 대해 본인 작업에 대한 문서화까지는 마무리해주시면 감사하겠습니다
| COPY app-main/build/libs/*.jar app.jar | ||
|
|
||
| # 4. 리소스 및 환경 파일 복사 | ||
| COPY /app-main/src/main/resources/application-local.yml /app/src/main/resources/application.yml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기서 local.yml이 복사되는게 맞나요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵! 맞습니다
| container_name: db_caucse_mysql | ||
| environment: | ||
| MYSQL_ROOT_PASSWORD: 1234 | ||
| MYSQL_DATABASE: db_caucse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이부분은 패스워드가 담겨있는데 민감정보류는 제외하고 작성해주셔야할 것 같습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
서버에 배포하기 위한 값이 아닌 로컬에서 테스트를 위해 사용하는 것이기 때문에 크게 문제가 되진 않을 것 같습니다. 추가로 패스워드의 경우도 직접 설정을 바꿔서 사용도 가능합니다.
패스워드 없이 접근이 가능하게도 설정이 가능하지만 일부 데이터베이스에서는 패스워드 없이 설정할 경우 몇몇 기능이나 접근이 막힐 수 있습니다. 그래도 문제가 된다고 판단되시면 수정하도록 하겠습니다!
다른 분들도 의견 부탁드립니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
로컬 테스트용이면 괜찮을 것 같습니다.
GY102912
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
확인했습니다!
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
컨테이너 기반 테스트 환경을 구축하기 위한 Dockerfile과 docker-compose.yml 파일을 추가하신 것을 확인했습니다. 전반적으로 잘 작성되었지만, 몇 가지 보안 및 안정성, 그리고 빌드 설정 관련 개선점을 제안합니다. 주요 내용은 Dockerfile의 COPY 경로 수정, docker-compose.yml의 하드코딩된 비밀번호 제거, Redis 이미지 버전 명시 등입니다. 자세한 내용은 각 파일에 대한 개별 코멘트를 참고해주세요.
| COPY /app-main/src/main/resources/application-local.yml /app/src/main/resources/application.yml | ||
| COPY /app-main/src/main/resources/dongnae_firebase_key.json /app/src/main/resources/dongnae_firebase_key.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
COPY 명령어의 소스 경로가 절대 경로(/app-main/...)로 지정되어 있습니다. docker-compose.yml에서 빌드 컨텍스트를 . (프로젝트 루트)로 설정했기 때문에, 경로는 컨텍스트에 상대적이어야 합니다. 현재 설정은 빌드 시 파일을 찾지 못해 오류를 발생시킬 수 있습니다. 맨 앞의 /를 제거하여 상대 경로로 수정해야 합니다.
COPY app-main/src/main/resources/application-local.yml /app/src/main/resources/application.yml
COPY app-main/src/main/resources/dongnae_firebase_key.json /app/src/main/resources/dongnae_firebase_key.json
| image: mysql:8.0 | ||
| container_name: db_caucse_mysql | ||
| environment: | ||
| MYSQL_ROOT_PASSWORD: 1234 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MYSQL_ROOT_PASSWORD가 파일에 하드코딩되어 있습니다. 이는 심각한 보안 문제입니다. 민감한 정보는 버전 관리에 포함되어서는 안 되며, .env 파일을 통해 주입하는 것이 좋습니다.
프로젝트 루트에 .env 파일을 만들고, MYSQL_ROOT_PASSWORD=your_secret_password와 같이 변수를 정의한 뒤, docker-compose.yml에서는 ${MYSQL_ROOT_PASSWORD}와 같이 참조하도록 수정하는 것을 권장합니다. .env 파일은 반드시 .gitignore에 추가해야 합니다.
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
| volumes: | ||
| - ./mysql_data:/var/lib/mysql | ||
| healthcheck: | ||
| test: ["CMD-SHELL", "mysqladmin ping -h localhost -u root -p1234"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| SPRING_DATASOURCE_USERNAME: root | ||
| SPRING_DATASOURCE_PASSWORD: 1234 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| retries: 5 | ||
|
|
||
| redis: | ||
| image: redis:latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| ### 1. app-main 빌드 | ||
|
|
||
| > 변경된 코드나 의존성이 있을 경우 이미지를 다시 빌드해야 합니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"app-main 빌드" 섹션에서 코드 변경 시 이미지를 다시 빌드해야 한다고 설명하고 있지만, 구체적인 명령어가 없어 사용자에게 혼동을 줄 수 있습니다. 이미지 재빌드를 포함하여 컨테이너를 실행하는 docker compose up --build 명령어를 명시해주면 사용자가 더 쉽게 이해하고 사용할 수 있을 것입니다.
| > 변경된 코드나 의존성이 있을 경우 이미지를 다시 빌드해야 합니다. | |
| > 변경된 코드나 의존성이 있을 경우 `docker compose up --build` 명령어로 이미지를 다시 빌드해야 합니다. |
🚩 관련사항
https://www.notion.so/2293d138d33c80e8a6a7fd94515e3ca9
컨테이너 환경에서 테스트를 진행하기 위해 dockerfile과 docker-compose 작성하였습니다!
추후에 채팅서버도 추가하여 채팅서버와 메인서버와의 통신이 잘되는지도 확인하면 좋을 것 같습니다.
📢 전달사항
어떤 버그나 오류가 발생했는지,
무슨 이유로 코드를 생성하거나 변경했는지,
어떤 부분을 집중적으로 봐줘야하는지 등
내용을 상세히 적어주세요.
📸 스크린샷
관련한 스크린샷을 첨부해주세요.
📃 진행사항
⚙️ 기타사항
기타 참고사항을 적어주세요.
개발기간: