feat: support resource limits on the build container
Adds a `docker-args-process-build` trigger to the resource plugin so limits set via `dokku resource:limit --process-type build APP` are applied during the build phase. Only `build.limit.*` properties are read - defaults do not inherit, since builds typically need more memory than runtime and a leaked tiny default would cause confusing OOM failures. Reservations are never applied at build time. Allowed flags are filtered per builder: herokuish gets cpu, memory, memory-swap, and nvidia-gpu; dockerfile gets memory and memory-swap; pack, nixpacks, railpack, lambda, and null emit nothing because their underlying CLIs do not accept docker run resource flags. The dockerfile builder whitelists the new memory flags and corrects pre-existing typos where `--ssh` mapped to `--platform` and `--ulimit` mapped to `--tag`.
This commit is contained in:
@@ -141,6 +141,28 @@ trigger-builder-dockerfile-builder-build() {
|
||||
DOCKERFILE_ARGS+=("--label" "${1#--label=}")
|
||||
shift 1
|
||||
;;
|
||||
--memory | -m)
|
||||
DOCKERFILE_ARGS+=("--memory")
|
||||
DOCKERFILE_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--memory=* | -m=*)
|
||||
if [[ "$1" == "--memory=*" ]]; then
|
||||
DOCKERFILE_ARGS+=("--memory" "${1#--memory=}")
|
||||
elif [[ "$1" == "-m=*" ]]; then
|
||||
DOCKERFILE_ARGS+=("--memory" "${1#-m=}")
|
||||
fi
|
||||
shift 1
|
||||
;;
|
||||
--memory-swap)
|
||||
DOCKERFILE_ARGS+=("--memory-swap")
|
||||
DOCKERFILE_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--memory-swap=*)
|
||||
DOCKERFILE_ARGS+=("--memory-swap" "${1#--memory-swap=}")
|
||||
shift 1
|
||||
;;
|
||||
--network)
|
||||
DOCKERFILE_ARGS+=("--network")
|
||||
DOCKERFILE_ARGS+=("$2")
|
||||
@@ -205,7 +227,7 @@ trigger-builder-dockerfile-builder-build() {
|
||||
shift 1
|
||||
;;
|
||||
--ssh)
|
||||
DOCKERFILE_ARGS+=("--platform")
|
||||
DOCKERFILE_ARGS+=("--ssh")
|
||||
DOCKERFILE_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
@@ -213,6 +235,15 @@ trigger-builder-dockerfile-builder-build() {
|
||||
DOCKERFILE_ARGS+=("--ssh" "${1#--ssh=}")
|
||||
shift 1
|
||||
;;
|
||||
--tag)
|
||||
DOCKERFILE_ARGS+=("--tag")
|
||||
DOCKERFILE_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--tag=*)
|
||||
DOCKERFILE_ARGS+=("--tag" "${1#--tag=}")
|
||||
shift 1
|
||||
;;
|
||||
--target)
|
||||
DOCKERFILE_ARGS+=("--target")
|
||||
DOCKERFILE_ARGS+=("$2")
|
||||
@@ -223,12 +254,12 @@ trigger-builder-dockerfile-builder-build() {
|
||||
shift 1
|
||||
;;
|
||||
--ulimit)
|
||||
DOCKERFILE_ARGS+=("--tag")
|
||||
DOCKERFILE_ARGS+=("--ulimit")
|
||||
DOCKERFILE_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--tag=*)
|
||||
DOCKERFILE_ARGS+=("--tag" "${1#--tag=}")
|
||||
--ulimit=*)
|
||||
DOCKERFILE_ARGS+=("--ulimit" "${1#--ulimit=}")
|
||||
shift 1
|
||||
;;
|
||||
--check | -D | --debug | --no-cache)
|
||||
|
||||
Reference in New Issue
Block a user