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
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

set -e

BASE_DIR="$(cd "$(dirname "$0")/../.." && pwd)"

echo "Stopping all docker containers..."
docker compose -f docker-compose.local.yml down
docker compose -f "${BASE_DIR}/docker-compose.local.yml" down

echo "Pruning unused Docker images..."
docker image prune -f
Expand Down
25 changes: 25 additions & 0 deletions docs/script/local_compose_up.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# 명령이 0이 아닌 종료값을 가질때 즉시 종료
set -e
Comment on lines +3 to +4
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

set 옵션을 강화해 스크립트 안전성을 높여주세요.

1. `set -e` 만으로는 정의되지 않은 변수를 참조하거나 파이프라인 중간 단계에서 오류가 나도 무시될 수 있습니다.  
2. `set -u -o pipefail` 을 함께 설정하면 예기치 못한 런타임 오류를 초기에 포착할 수 있어 운영 중단 가능성을 낮춥니다.
-set -e
+set -euo pipefail
📝 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
# 명령이 0이 아닌 종료값을 가질때 즉시 종료
set -e
# 명령이 0이 아닌 종료값을 가질때 즉시 종료
-set -e
+set -euo pipefail
🤖 Prompt for AI Agents
In docs/script/local_compose_up.sh at lines 3 to 4, the script currently uses
only 'set -e' which does not catch undefined variable references or errors in
intermediate pipeline commands. To improve script safety, add 'set -u' to treat
unset variables as errors and 'set -o pipefail' to ensure the script fails if
any command in a pipeline fails. Update the set command to 'set -euo pipefail'
to enable all these options together.


BASE_DIR="$(cd "$(dirname "$0")/../.." && pwd)"

if [ ! -d "${BASE_DIR}/mysql_data_local" ]; then
echo "mysql_data_local 디렉토리가 없습니다. ${BASE_DIR}/mysql_data_local 디렉토리를 생성합니다."
mkdir -p "${BASE_DIR}/mysql_data_local"
fi

if [ ! -d "${BASE_DIR}/redis_data_local" ]; then
echo "redis_data_local 디렉토리가 없습니다. ${BASE_DIR}/redis_data_local 디렉토리를 생성합니다."
mkdir -p "${BASE_DIR}/redis_data_local"
fi

echo "Starting all docker containers..."
docker compose -f "${BASE_DIR}/docker-compose.local.yml" up -d
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

docker-compose.local.yml 존재 여부를 선검사해 예외 처리하세요.

1. 파일이 없을 경우 `docker compose` 는 불친절한 스택 트레이스를 남기고 종료합니다.  
2. 실행 전 파일 존재를 확인해 명확한 오류 메시지를 주면 디버깅 비용이 줄어듭니다.
+if [ ! -f "${BASE_DIR}/docker-compose.local.yml" ]; then
+  echo "❌ ${BASE_DIR}/docker-compose.local.yml 파일을 찾을 수 없습니다." >&2
+  exit 1
+fi
+
 docker compose -f "${BASE_DIR}/docker-compose.local.yml" up -d
📝 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
docker compose -f "${BASE_DIR}/docker-compose.local.yml" up -d
# … earlier in the script …
# ③ docker-compose.local.yml 존재 여부 검사
if [ ! -f "${BASE_DIR}/docker-compose.local.yml" ]; then
echo "${BASE_DIR}/docker-compose.local.yml 파일을 찾을 수 없습니다." >&2
exit 1
fi
docker compose -f "${BASE_DIR}/docker-compose.local.yml" up -d
🤖 Prompt for AI Agents
In docs/script/local_compose_up.sh at line 19, the script runs docker compose
with docker-compose.local.yml without checking if the file exists. Add a check
before this line to verify the presence of docker-compose.local.yml, and if it
does not exist, print a clear error message and exit the script to prevent
unclear stack traces from docker compose.


echo "Pruning unused Docker images..."
docker image prune -f

echo "Containers are up and running."
docker compose ps -a
23 changes: 0 additions & 23 deletions local_compose_up.sh

This file was deleted.

Loading