Skip to content

Conversation

@OH-GITAEK
Copy link
Contributor

🚩 관련사항

https://www.notion.so/2293d138d33c80e8a6a7fd94515e3ca9

컨테이너 환경에서 테스트를 진행하기 위해 dockerfile과 docker-compose 작성하였습니다!
추후에 채팅서버도 추가하여 채팅서버와 메인서버와의 통신이 잘되는지도 확인하면 좋을 것 같습니다.

📢 전달사항

어떤 버그나 오류가 발생했는지,
무슨 이유로 코드를 생성하거나 변경했는지,
어떤 부분을 집중적으로 봐줘야하는지 등
내용을 상세히 적어주세요.

📸 스크린샷

관련한 스크린샷을 첨부해주세요.

📃 진행사항

  • done1
  • done2 (진행되었어야 하는데 미처 하지 못한 부분 혹은 관련하여 앞으로 진행되어야 하는 부분도 전부 적어서 체크 표시로 관리해주세요.)

⚙️ 기타사항

기타 참고사항을 적어주세요.

개발기간:

@OH-GITAEK OH-GITAEK self-assigned this Jul 28, 2025
@github-actions
Copy link

github-actions bot commented Jul 28, 2025

Test Results Summary

 46 files   46 suites   14s ⏱️
222 tests 222 ✅ 0 💤 0 ❌
258 runs  258 ✅ 0 💤 0 ❌

Results for commit d59e32d.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Jul 28, 2025

Migration Result 📦

Status Count
✅ Success 13
❌ Failed 0
⏳ Pending 0

Schema Validation Result 🔍

✅ No schema mismatches detected.

Results for commit d59e32d

♻️ This comment has been updated with latest results.

Copy link
Contributor

@pstar987 pstar987 left a 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
Copy link
Contributor

Choose a reason for hiding this comment

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

여기서 local.yml이 복사되는게 맞나요?

Copy link
Contributor Author

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
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
Contributor Author

Choose a reason for hiding this comment

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

서버에 배포하기 위한 값이 아닌 로컬에서 테스트를 위해 사용하는 것이기 때문에 크게 문제가 되진 않을 것 같습니다. 추가로 패스워드의 경우도 직접 설정을 바꿔서 사용도 가능합니다.
패스워드 없이 접근이 가능하게도 설정이 가능하지만 일부 데이터베이스에서는 패스워드 없이 설정할 경우 몇몇 기능이나 접근이 막힐 수 있습니다. 그래도 문제가 된다고 판단되시면 수정하도록 하겠습니다!
다른 분들도 의견 부탁드립니다.

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
Contributor

@GY102912 GY102912 left a comment

Choose a reason for hiding this comment

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

확인했습니다!

@bingle625
Copy link
Contributor

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 이미지 버전 명시 등입니다. 자세한 내용은 각 파일에 대한 개별 코멘트를 참고해주세요.

Comment on lines +11 to +12
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
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

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
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

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"]
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

healthcheck에서도 MySQL 비밀번호가 하드코딩되어 있습니다. 이 또한 .env 파일의 변수를 참조하도록 변경해야 합니다. mysqladmin 명령어에 직접 비밀번호를 전달하는 대신, MYSQL_PWD 환경 변수를 사용하는 것이 더 안전합니다.

      test: ["CMD-SHELL", "MYSQL_PWD=${MYSQL_ROOT_PASSWORD} mysqladmin ping -h localhost -u root"]

Comment on lines +45 to +46
SPRING_DATASOURCE_USERNAME: root
SPRING_DATASOURCE_PASSWORD: 1234
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

데이터베이스 접속 정보(SPRING_DATASOURCE_USERNAME, SPRING_DATASOURCE_PASSWORD)가 하드코딩되어 있습니다. 이는 심각한 보안 문제입니다. .env 파일을 사용하여 이 값들을 외부에서 주입하고, .gitignore.env 파일을 추가하여 저장소에 포함되지 않도록 해야 합니다.

      SPRING_DATASOURCE_USERNAME: ${SPRING_DATASOURCE_USERNAME}
      SPRING_DATASOURCE_PASSWORD: ${SPRING_DATASOURCE_PASSWORD}

retries: 5

redis:
image: redis:latest
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Redis 이미지에 latest 태그를 사용하고 있습니다. latest 태그는 예기치 않은 버전 변경을 유발하여 빌드의 재현성을 해칠 수 있습니다. 안정적인 운영과 테스트 환경을 위해 redis:7.2와 같이 특정 버전을 명시하는 것이 좋습니다.

    image: redis:7.2


### 1. app-main 빌드

> 변경된 코드나 의존성이 있을 경우 이미지를 다시 빌드해야 합니다.
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

"app-main 빌드" 섹션에서 코드 변경 시 이미지를 다시 빌드해야 한다고 설명하고 있지만, 구체적인 명령어가 없어 사용자에게 혼동을 줄 수 있습니다. 이미지 재빌드를 포함하여 컨테이너를 실행하는 docker compose up --build 명령어를 명시해주면 사용자가 더 쉽게 이해하고 사용할 수 있을 것입니다.

Suggested change
> 변경된 코드나 의존성이 있을 경우 이미지를 다시 빌드해야 합니다.
> 변경된 코드나 의존성이 있을 경우 `docker compose up --build` 명령어로 이미지를 다시 빌드해야 합니다.

@bingle625 bingle625 closed this Jan 4, 2026
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.

5 participants