Skip to content

Commit d581563

Browse files
authored
chore: Add resource limits to testing mode (#77)
1 parent 6996555 commit d581563

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

docker/scripts/dev_start.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ TIMEZONE_CN=(
6363

6464
# --- Constants: Container Resources ---
6565
# Resource limits (can be overridden by environment variables)
66-
DOCKER_CPUS="${DOCKER_CPUS:-8}"
66+
DOCKER_CPUS="${DOCKER_CPUS:-4}"
6767
DOCKER_MEMORY="${DOCKER_MEMORY:-8g}"
6868

6969
# --- Constants: Image Name and Versions ---
@@ -563,10 +563,12 @@ function main() {
563563
564564
# Add resource limits (cpus, memory)
565565
# TODO(zero): move to CI, --memory will force OOM when the content exceeds the memory limit.
566-
local resource_opts=(
567-
# --cpus="${DOCKER_CPUS}"
568-
# --memory="${DOCKER_MEMORY}"
569-
)
566+
if [[ "${CUSTOM_DIST}" == "testing" ]]; then
567+
local resource_opts=(
568+
--cpus="${DOCKER_CPUS}"
569+
--memory="${DOCKER_MEMORY}"
570+
)
571+
fi
570572
571573
# --- Phase 4: Run the Container ---
572574
info "Starting Docker container \"${DEV_CONTAINER}\" from image: ${FULL_IMAGE_NAME} ..."

0 commit comments

Comments
 (0)