From 87e54d8823b71ec086d2abfa450699e40cccc88a Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Tue, 29 Oct 2024 10:56:42 +0800 Subject: [PATCH] perf: add cron (#14364) * perf: add cron * Update Dockerfile-base * perf: Update Dockerfile with new base image tag --------- Co-authored-by: ibuler <ibuler@qq.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> --- Dockerfile | 2 +- Dockerfile-base | 5 +++++ entrypoint.sh | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a1091295c..db01ffb12 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM jumpserver/core-base:20241022_070738 AS stage-build +FROM jumpserver/core-base:20241028_064236 AS stage-build ARG VERSION diff --git a/Dockerfile-base b/Dockerfile-base index e76fd69fe..bd9440167 100644 --- a/Dockerfile-base +++ b/Dockerfile-base @@ -5,6 +5,7 @@ ARG TARGETARCH ARG DEPENDENCIES=" \ ca-certificates \ wget \ + cron \ gettext" ARG APT_MIRROR=http://deb.debian.org @@ -19,6 +20,10 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=core \ && apt-get -y install --no-install-recommends ${DEPENDENCIES} \ && echo "no" | dpkg-reconfigure dash +# Clean up /tmp +RUN echo "0 3 * * * root find /tmp -type f -mtime +1 -size +1M -exec rm -f {} \; && date > /tmp/clean.log" > /etc/cron.d/cleanup_tmp \ + && chmod 0644 /etc/cron.d/cleanup_tmp + # Install bin tools ARG CHECK_VERSION=v1.0.4 RUN set -ex \ diff --git a/entrypoint.sh b/entrypoint.sh index acd23b51c..db28e7f5e 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -22,5 +22,6 @@ elif [[ "$action" == "sleep" ]];then echo "Sleep 365 days" sleep 365d else + which cron &>/dev/null && [[ ! -f /var/run/crond.pid ]] && cron || echo "" python jms "${action}" "${service}" fi