Skip to content

Commit

Permalink
fixup! feat(cli): build based on configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
tuler committed Oct 7, 2024
1 parent c28d308 commit 2ca70a3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 4 additions & 3 deletions apps/cli/src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const bootMachine = async (
// list of environment variables of docker image
const env = info?.env ?? [];
const envs = env.map(
(variable) => `--append-entrypoint="export ${variable}"`,
(variable) => `--append-entrypoint=export "${variable}"`,
);

// bootargs from config string array
Expand Down Expand Up @@ -105,10 +105,10 @@ const bootMachine = async (
`--ram-length=${ramLength}`,
"--final-hash",
"--store=image",
`--append-entrypoint="${entrypoint}"`,
`--append-entrypoint=${entrypoint}`,
];
if (info?.workdir) {
args.push(`--append-init="WORKDIR=${info.workdir}"`);
args.push(`--append-init=WORKDIR="${info.workdir}"`);
}
if (noRollup) {
args.push("--no-rollup");
Expand All @@ -123,6 +123,7 @@ const bootMachine = async (
return execaDockerFallback(command, args, {
cwd: destination,
image: sdkImage,
stdio: "inherit",
});
};

Expand Down
5 changes: 5 additions & 0 deletions apps/cli/src/exec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export const execaDockerFallback = async (
} catch (error) {
if (error instanceof ExecaError) {
if (error.code === "ENOENT" && options.image) {
console.warn(
`error executing '${command}', falling back to docker execution using image '${options.image}'`,
);
return await execa(
"docker",
[
Expand All @@ -32,6 +35,8 @@ export const execaDockerFallback = async (
],
options,
);
} else {
console.error(`error executing '${command}'`, error);
}
}
throw error;
Expand Down

0 comments on commit 2ca70a3

Please sign in to comment.