Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
14 changes: 13 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,25 @@ jobs:

# 프로젝트 디렉토리로 이동
cd ~/projects/GlobalNomad

# .env 파일 생성
echo "📝 Creating .env file from secrets..."
# 기존 .env 파일이 있다면 삭제하여 최신 상태 유지
rm -f .env
touch .env
Comment on lines +111 to +112
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

.env 파일 권한을 제한하여 서버 내 노출을 방지하세요
파일을 만들기만 하고 권한을 조정하지 않아 기본 umask 값에 따라 다른 사용자도 읽을 수 있습니다.

 touch .env
+chmod 600 .env  # 소유자만 읽기/쓰기
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
rm -f .env
touch .env
rm -f .env
touch .env
chmod 600 .env # 소유자만 읽기/쓰기
🤖 Prompt for AI Agents
In .github/workflows/deploy.yml at lines 111 to 112, after creating the .env
file with 'touch .env', set restrictive file permissions to prevent other users
on the server from reading it. Add a command like 'chmod 600 .env' immediately
after 'touch .env' to limit access to the file owner only.

echo "NEXT_PUBLIC_API_URL=${{ secrets.NEXT_PUBLIC_API_URL }}" >> .env
echo "NEXT_PUBLIC_TEAM_ID=${{ secrets.NEXT_PUBLIC_TEAM_ID }}" >> .env
echo "NEXT_PUBLIC_API_SERVER_URL=${{ secrets.NEXT_PUBLIC_API_SERVER_URL }}" >> .env
echo "NEXT_PUBLIC_KAKAO_CLIENT_ID=${{ secrets.NEXT_PUBLIC_KAKAO_CLIENT_ID }}" >> .env
echo "NEXT_PUBLIC_KAKAO_APP_JS_KEY=${{ secrets.NEXT_PUBLIC_KAKAO_APP_JS_KEY }}" >> .env
echo "NEXT_PUBLIC_SITE_URL=${{ secrets.NEXT_PUBLIC_SITE_URL }}" >> .env

# 최신 코드 가져오기
echo "🔄 Pulling latest code..."
git pull origin develop

Comment on lines 119 to 123
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

불필요한 공백(trailing spaces) 삭제 권장
YAML lint 경고가 발생하므로 줄 끝 공백을 제거해 워크플로 파일 품질을 유지하세요.

🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 119-119: trailing spaces

(trailing-spaces)


[error] 123-123: trailing spaces

(trailing-spaces)

🤖 Prompt for AI Agents
In .github/workflows/deploy.yml around lines 119 to 123, there are trailing
spaces at the end of some lines causing YAML lint warnings. Remove all trailing
spaces from these lines to ensure the workflow file is clean and free of
formatting issues.

# GHCR 로그인 (PAT 사용)
echo "🔐 Logging in to GHCR..."
echo "🔐 Logging in to GHCR..."
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

로그 메시지에 불필요한 ‘ㅇ’ 문자가 포함되어 있습니다
🔐ㅇ Logging in to GHCR...🔐 Logging in to GHCR... 로 수정해 가독성을 높이세요.

🤖 Prompt for AI Agents
In .github/workflows/deploy.yml at line 125, remove the unnecessary 'ㅇ'
character from the log message so that it reads "🔐 Logging in to GHCR..."
instead of "🔐ㅇ Logging in to GHCR...". This will improve the readability of the
log output.

echo "${{ secrets.GHCR_PAT }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

# 현재 실행 중인 이미지 태그 저장 (롤백용)
Expand Down
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ services:
context: .
dockerfile: Dockerfile
restart: unless-stopped

env_file:
- .env

Comment on lines +15 to +17
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

.env 경로 및 버전관리 제외 여부 확인 필요

env_file: - .env 추가는 배포 스크립트와 잘 연동되지만,

  1. .env 파일이 저장소에 커밋되지 않았는지(.gitignore) 한 번 더 확인해 주세요.
  2. 컨테이너 실행 디렉터리와 .env 위치가 다를 경우 경로가 틀릴 수 있으니 로컬·서버 모두에서 정상 로드되는지 테스트가 필요합니다.

별도 변경은 없어도 되지만 배포 전 두 항목을 검증해 주세요.


아래 스크립트를 실행해 .gitignore.env가 무시 대상으로 등록되어 있는지, 저장소 루트에 .env 파일이 실제로 커밋되지 않았는지 확인해 주세요.

위 결과를 바탕으로 .env 파일이 버전관리에서 제외되어 있는지, 그리고 로컬·서버 환경에서 docker-compose가 .env를 정상 로드하는지 확인해 주세요.


🏁 Script executed:

#!/bin/bash
# 1) .gitignore에 .env가 등록되어 있는지 확인
echo "🔍 .gitignore에서 '.env' 무시 설정 확인"
rg -n '^\s*\.env(\s*#.*)?$' .gitignore || echo "⚠️ .gitignore에 '.env'가 없습니다."

# 2) 저장소 루트에 .env 파일이 커밋된 상태인지 확인
echo "🔍 저장소 루트에 '.env' 파일 존재 여부 확인"
if ls -A | grep -q '^\.env$'; then
  echo "⚠️ 저장소에 '.env' 파일이 존재합니다. 커밋되지 않도록 .gitignore에 추가해주세요."
else
  echo "✅ '.env' 파일이 커밋되지 않았습니다."
fi

Length of output: 360


.env 무시 설정 추가 및 로드 테스트 필요

  • .gitignore에 .env 항목이 누락되어 있으므로, 저장소에 커밋되지 않도록 아래 라인을 추가해주세요.
    .env
  • 현재 .env 파일은 커밋되지 않은 상태임을 확인했습니다.
  • 로컬·서버 환경에서 docker-compose up 실행 시 .env 파일이 정상적으로 로드되는지 반드시 테스트해주세요.
🤖 Prompt for AI Agents
In docker-compose.yml around lines 15 to 17, the .env file is referenced but not
ignored in version control. Add a line with ".env" to the .gitignore file to
prevent committing this sensitive file. After updating .gitignore, run
"docker-compose up" locally and on the server to verify that the .env file loads
correctly without being tracked by git.

environment:
- NODE_ENV=production
networks:
Expand Down