From f30f1f81a3c33dd5af5ca7752b912852cfb69c96 Mon Sep 17 00:00:00 2001 From: Mike Henry <11765982+mikemhenry@users.noreply.github.com> Date: Fri, 28 Jul 2023 02:30:00 -0700 Subject: [PATCH 1/3] added --rm flag to docker run --- conda_smithy/templates/run_docker_build.sh.tmpl | 1 + 1 file changed, 1 insertion(+) diff --git a/conda_smithy/templates/run_docker_build.sh.tmpl b/conda_smithy/templates/run_docker_build.sh.tmpl index 1e3c2bd02..2f6d9c024 100644 --- a/conda_smithy/templates/run_docker_build.sh.tmpl +++ b/conda_smithy/templates/run_docker_build.sh.tmpl @@ -78,6 +78,7 @@ export UPLOAD_PACKAGES="${UPLOAD_PACKAGES:-True}" export IS_PR_BUILD="${IS_PR_BUILD:-False}" {{ docker.executable }} pull "${DOCKER_IMAGE}" {{ docker.executable }} run ${DOCKER_RUN_ARGS} \ + --rm \ -v "${RECIPE_ROOT}":/home/conda/recipe_root:rw,z,delegated \ -v "${FEEDSTOCK_ROOT}":/home/conda/feedstock_root:rw,z,delegated \ -e CONFIG \ From 286248b5ad17e0de12096b18a59bca3160914832 Mon Sep 17 00:00:00 2001 From: Mike Henry <11765982+mikemhenry@users.noreply.github.com> Date: Fri, 28 Jul 2023 02:42:27 -0700 Subject: [PATCH 2/3] Added news entry --- news/make_docker_rm_default.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 news/make_docker_rm_default.rst diff --git a/news/make_docker_rm_default.rst b/news/make_docker_rm_default.rst new file mode 100644 index 000000000..e73626821 --- /dev/null +++ b/news/make_docker_rm_default.rst @@ -0,0 +1,23 @@ +**Added:** + +* Now --rm is added to docker run by default in run_docker_build.sh + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* From 2e2ab50ca521a200ad96c108c583a0e4c85fc95c Mon Sep 17 00:00:00 2001 From: Mike Henry <11765982+mikemhenry@users.noreply.github.com> Date: Fri, 28 Jul 2023 17:34:36 -0700 Subject: [PATCH 3/3] only add --rm if CONDA_FORGE_DOCKER_RUN_ARGS is not set --- conda_smithy/templates/run_docker_build.sh.tmpl | 5 ++--- news/make_docker_rm_default.rst | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/conda_smithy/templates/run_docker_build.sh.tmpl b/conda_smithy/templates/run_docker_build.sh.tmpl index 2f6d9c024..749117286 100644 --- a/conda_smithy/templates/run_docker_build.sh.tmpl +++ b/conda_smithy/templates/run_docker_build.sh.tmpl @@ -64,8 +64,8 @@ mkdir -p "$ARTIFACTS" DONE_CANARY="$ARTIFACTS/conda-forge-build-done-${CONFIG}" rm -f "$DONE_CANARY" -# Allow people to specify extra default arguments to `docker run` (e.g. `--rm`) -DOCKER_RUN_ARGS="${CONDA_FORGE_DOCKER_RUN_ARGS}" +# Allow people to specify extra default arguments to `docker run` (e.g. `--memory-swappiness=0`) +DOCKER_RUN_ARGS="${CONDA_FORGE_DOCKER_RUN_ARGS:---rm}" if [ -z "${CI}" ]; then DOCKER_RUN_ARGS="-it ${DOCKER_RUN_ARGS}" fi @@ -78,7 +78,6 @@ export UPLOAD_PACKAGES="${UPLOAD_PACKAGES:-True}" export IS_PR_BUILD="${IS_PR_BUILD:-False}" {{ docker.executable }} pull "${DOCKER_IMAGE}" {{ docker.executable }} run ${DOCKER_RUN_ARGS} \ - --rm \ -v "${RECIPE_ROOT}":/home/conda/recipe_root:rw,z,delegated \ -v "${FEEDSTOCK_ROOT}":/home/conda/feedstock_root:rw,z,delegated \ -e CONFIG \ diff --git a/news/make_docker_rm_default.rst b/news/make_docker_rm_default.rst index e73626821..02fffa51d 100644 --- a/news/make_docker_rm_default.rst +++ b/news/make_docker_rm_default.rst @@ -1,10 +1,10 @@ **Added:** -* Now --rm is added to docker run by default in run_docker_build.sh +* **Changed:** -* +* If `CONDA_FORGE_DOCKER_RUN_ARGS` is not set, `--rm` is added to `docker run ...` in run_docker_build.sh **Deprecated:**