Skip to content

Commit fdf14e0

Browse files
committed
cleanup completed docker containers by default
1 parent 650533b commit fdf14e0

File tree

4 files changed

+7
-0
lines changed

4 files changed

+7
-0
lines changed

apps/supervisor/src/env.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const Env = z.object({
2727
RUNNER_HEARTBEAT_INTERVAL_SECONDS: z.coerce.number().optional(),
2828
RUNNER_SNAPSHOT_POLL_INTERVAL_SECONDS: z.coerce.number().optional(),
2929
RUNNER_ADDITIONAL_ENV_VARS: AdditionalEnvVars, // optional (csv)
30+
RUNNER_DOCKER_AUTOREMOVE: BoolEnv.default(true),
3031

3132
// Dequeue settings (provider mode)
3233
TRIGGER_DEQUEUE_ENABLED: BoolEnv.default("true"),

apps/supervisor/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class ManagedSupervisor {
6666
heartbeatIntervalSeconds: env.RUNNER_HEARTBEAT_INTERVAL_SECONDS,
6767
snapshotPollIntervalSeconds: env.RUNNER_SNAPSHOT_POLL_INTERVAL_SECONDS,
6868
additionalEnvVars: env.RUNNER_ADDITIONAL_ENV_VARS,
69+
dockerAutoremove: env.RUNNER_DOCKER_AUTOREMOVE,
6970
} satisfies WorkloadManagerOptions;
7071

7172
if (this.isKubernetes) {

apps/supervisor/src/workloadManager/docker.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ export class DockerWorkloadManager implements WorkloadManager {
4343
`--name=${runnerId}`,
4444
];
4545

46+
if (this.opts.dockerAutoremove) {
47+
runArgs.push("--rm");
48+
}
49+
4650
if (this.opts.warmStartUrl) {
4751
runArgs.push(`--env=TRIGGER_WARM_START_URL=${this.opts.warmStartUrl}`);
4852
}

apps/supervisor/src/workloadManager/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export interface WorkloadManagerOptions {
1010
heartbeatIntervalSeconds?: number;
1111
snapshotPollIntervalSeconds?: number;
1212
additionalEnvVars?: Record<string, string>;
13+
dockerAutoremove?: boolean;
1314
}
1415

1516
export interface WorkloadManager {

0 commit comments

Comments
 (0)