Skip to content

Commit 93c561c

Browse files
author
Conner Aldrich
committed
feat(cli): remove --base-image-node flag
The `--base-image-node` CLI option was a simple alternative to the more flexible `--containerfile-module` for swapping the per-deploy base image. We don't use it anywhere; `--containerfile-module` covers the same use case and more (the `custom-base-image.mjs` example shows the migration pattern). Drop: - `baseImageNode` zod schema field on DeployCommandOptions - `--base-image-node` Commander flag - `baseImageNode` field on BuildImageOptions, DepotBuildImageOptions, SelfHostedBuildImageOptions, GenerateContainerfileOptions, and BuildWorkerOptions - `baseImageNode` plumbing through buildImage / writeContainerfile - The override branch in parseGenerateOptions - All references in examples/README.md (point users at --containerfile-module + the custom-base-image.mjs example instead)
1 parent d4b5ff9 commit 93c561c

4 files changed

Lines changed: 11 additions & 33 deletions

File tree

packages/cli-v3/examples/README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ export default {
4242
// - image: Image configuration with packages and instructions
4343
// - indexScript: Path to the indexing script
4444
// - entrypoint: Path to the runtime entrypoint
45-
// - baseImageNode: Custom base image if provided via --base-image-node
4645
// - containerfileModule: Path to this module
4746

4847
return `FROM your-base-image:latest
@@ -96,7 +95,6 @@ The `options` parameter passed to your `generate` function contains:
9695
},
9796
indexScript: string, // e.g., ".trigger/index.mjs"
9897
entrypoint: string, // e.g., ".trigger/run.mjs"
99-
baseImageNode?: string, // If --base-image-node was provided
10098
containerfileModule?: string // Path to your module
10199
}
102100
```
@@ -112,10 +110,9 @@ When using custom base images:
112110

113111
## Quick Start
114112

115-
For simple base image replacement, you can also use the `--base-image-node` flag without a custom module:
113+
To swap the base image (or do anything more invasive), create a containerfile
114+
module like the examples above and pass it via `--containerfile-module`:
116115

117116
```bash
118-
npx trigger.dev@latest deploy --base-image-node node:20-alpine
117+
npx trigger.dev@latest deploy --containerfile-module ./containerfile.mjs
119118
```
120-
121-
For full control, create a custom module and use `--containerfile-module`.

packages/cli-v3/src/build/buildWorker.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ export type BuildWorkerOptions = {
3636
rewritePaths?: boolean;
3737
forcedExternals?: string[];
3838
plain?: boolean;
39-
baseImageNode?: string;
4039
containerfileModule?: string;
4140
};
4241

@@ -111,7 +110,6 @@ export async function buildWorker(options: BuildWorkerOptions) {
111110
resolvedConfig,
112111
outputPath: options.destination,
113112
bundleResult,
114-
baseImageNode: options.baseImageNode,
115113
containerfileModule: options.containerfileModule,
116114
});
117115
}
@@ -172,14 +170,12 @@ async function writeDeployFiles({
172170
resolvedConfig,
173171
outputPath,
174172
bundleResult,
175-
baseImageNode,
176173
containerfileModule,
177174
}: {
178175
buildManifest: BuildManifest;
179176
resolvedConfig: ResolvedConfig;
180177
outputPath: string;
181178
bundleResult: BundleResult;
182-
baseImageNode?: string;
183179
containerfileModule?: string;
184180
}) {
185181
// Step 1. Read the package.json file
@@ -217,7 +213,7 @@ async function writeDeployFiles({
217213
);
218214

219215
await writeJSONFile(join(outputPath, "build.json"), buildManifestToJSON(buildManifest));
220-
await writeContainerfile(outputPath, buildManifest, baseImageNode, containerfileModule);
216+
await writeContainerfile(outputPath, buildManifest, containerfileModule);
221217
}
222218

223219
async function readProjectPackageJson(packageJsonPath: string) {
@@ -226,7 +222,11 @@ async function readProjectPackageJson(packageJsonPath: string) {
226222
return packageJson;
227223
}
228224

229-
async function writeContainerfile(outputPath: string, buildManifest: BuildManifest, baseImageNode?: string, containerfileModule?: string) {
225+
async function writeContainerfile(
226+
outputPath: string,
227+
buildManifest: BuildManifest,
228+
containerfileModule?: string
229+
) {
230230
if (!buildManifest.runControllerEntryPoint || !buildManifest.indexControllerEntryPoint) {
231231
throw new Error("Something went wrong with the build. Aborting deployment. [code 7789]");
232232
}
@@ -237,7 +237,6 @@ async function writeContainerfile(outputPath: string, buildManifest: BuildManife
237237
build: buildManifest.build,
238238
image: buildManifest.image,
239239
indexScript: buildManifest.indexControllerEntryPoint,
240-
baseImageNode,
241240
containerfileModule,
242241
});
243242

packages/cli-v3/src/commands/deploy.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ const DeployCommandOptions = CommonCommandOptions.extend({
9595
repository: z.string().optional(),
9696
buildOnly: z.boolean().default(false),
9797
registerOnly: z.boolean().default(false),
98-
baseImageNode: z.string().optional(),
9998
containerfileModule: z.string().optional(),
10099
skipDigest: z.boolean().default(false),
101100
});
@@ -152,10 +151,6 @@ export function configureDeployCommand(program: Command) {
152151
"--repository <repository>",
153152
"Docker repository path to use for build-only mode (defaults to trigger/<project>)"
154153
)
155-
.option(
156-
"--base-image-node <image>",
157-
"Custom base image for Node.js runtime (e.g., my-registry/node:21-slim)"
158-
)
159154
.option(
160155
"--containerfile-module <module>",
161156
"Path to a JavaScript/TypeScript module that exports a containerfile template"
@@ -442,7 +437,6 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
442437
envVars: serverEnvVars.success ? serverEnvVars.data.variables : {},
443438
forcedExternals,
444439
plain: options.plain,
445-
baseImageNode: options.baseImageNode,
446440
containerfileModule: options.containerfileModule,
447441
listener: {
448442
onBundleStart() {
@@ -1615,7 +1609,6 @@ async function buildOnlyDeploy(projectPath: string, dir: string, options: Deploy
16151609
rewritePaths: true,
16161610
envVars: {}, // No server env vars in build-only mode
16171611
forcedExternals: alwaysExternal,
1618-
baseImageNode: options.baseImageNode,
16191612
containerfileModule: options.containerfileModule,
16201613
listener: {
16211614
onBundleStart() {

packages/cli-v3/src/deploy/buildImage.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ export interface BuildImageOptions {
5353
buildEnvVars?: Record<string, string | undefined>;
5454
indexEnvVars?: Record<string, string>; // Environment variables for indexing
5555
onLog?: (log: string) => void;
56-
baseImageNode?: string; // Custom base image for Node.js runtime
5756
}
5857

5958
export async function buildImage(options: BuildImageOptions): Promise<BuildImageResults> {
@@ -90,7 +89,6 @@ export async function buildImage(options: BuildImageOptions): Promise<BuildImage
9089
compressionLevel,
9190
forceCompression,
9291
onLog,
93-
baseImageNode,
9492
} = options;
9593

9694
if (isLocalBuild) {
@@ -122,7 +120,6 @@ export async function buildImage(options: BuildImageOptions): Promise<BuildImage
122120
compressionLevel,
123121
forceCompression,
124122
onLog,
125-
baseImageNode,
126123
});
127124
}
128125

@@ -156,7 +153,6 @@ export async function buildImage(options: BuildImageOptions): Promise<BuildImage
156153
forceCompression,
157154
indexEnvVars,
158155
onLog,
159-
baseImageNode,
160156
});
161157
}
162158

@@ -184,7 +180,6 @@ export interface DepotBuildImageOptions {
184180
forceCompression?: boolean;
185181
indexEnvVars?: Record<string, string>;
186182
onLog?: (log: string) => void;
187-
baseImageNode?: string;
188183
}
189184

190185
type BuildImageSuccess = {
@@ -362,7 +357,6 @@ interface SelfHostedBuildImageOptions {
362357
compressionLevel?: number;
363358
forceCompression?: boolean;
364359
onLog?: (log: string) => void;
365-
baseImageNode?: string;
366360
}
367361

368362
async function localBuildImage(options: SelfHostedBuildImageOptions): Promise<BuildImageResults> {
@@ -974,7 +968,6 @@ export type GenerateContainerfileOptions = {
974968
image: BuildManifest["image"];
975969
indexScript: string;
976970
entrypoint: string;
977-
baseImageNode?: string;
978971
containerfileModule?: string;
979972
};
980973

@@ -1002,12 +995,8 @@ export const parseGenerateOptions = (options: GenerateContainerfileOptions) => {
1002995
const packages = Array.from(new Set(DEFAULT_PACKAGES.concat(options.image?.pkgs || []))).join(
1003996
" "
1004997
);
1005-
1006-
// Use custom base image for Node.js runtimes if provided
1007-
let baseImage = BASE_IMAGE[options.runtime];
1008-
if (options.baseImageNode && (options.runtime === "node" || options.runtime === "node-22")) {
1009-
baseImage = options.baseImageNode;
1010-
}
998+
999+
const baseImage = BASE_IMAGE[options.runtime];
10111000

10121001
return {
10131002
baseImage,

0 commit comments

Comments
 (0)