diff --git a/plugins/docker-compose/common.ts b/plugins/docker-compose/common.ts index 97c3a44a47f..9a0c93346ab 100644 --- a/plugins/docker-compose/common.ts +++ b/plugins/docker-compose/common.ts @@ -6,6 +6,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +import chalk from "chalk" import AsyncLock from "async-lock" import { sdk } from "@garden-io/sdk" import { DockerComposeDeploySpec, DockerComposeProjectSpec } from "./schemas" @@ -73,6 +74,7 @@ export async function runToolWithArgs(tool: PluginTool, params: ExecParams) { state = "ready" } catch (err) { state = "failed" + params.log.error(chalk.red(err.message)) success = false } diff --git a/plugins/docker-compose/index.ts b/plugins/docker-compose/index.ts index d40d8e37847..87743cdbe72 100644 --- a/plugins/docker-compose/index.ts +++ b/plugins/docker-compose/index.ts @@ -464,6 +464,9 @@ composeExecTest.addHandler("run", makeComposeExecHandler()) function getRunOpts(spec: sdk.types.infer) { const opts: string[] = [] + if (spec.command) { + opts.push("--entrypoint", spec.command.join(" ")) + } if (spec.name) { opts.push("--name", spec.name) } @@ -520,7 +523,7 @@ const makeDockerFreshHandler = () => { cwd: action.basePath(), args: [...opts, spec.image], log, - streamLogs: { ctx }, + streamLogs: { ctx, print: true }, }) return { @@ -567,11 +570,13 @@ const makeDockerComposeFreshHandler = () => { return async ({ ctx, log, action }) => { const spec = action.getSpec() - const opts = [ + const args = [ "run", - // "--build", // TODO: consider making this configurable? - ...spec.command || [], + "--build", // TODO: consider making this configurable? + "--remove-orphans", + "--no-deps", ...getRunOpts(spec), + spec.service, ] // TODO: add env var flags @@ -584,9 +589,9 @@ const makeDockerComposeFreshHandler = () => { output, } = await runToolWithArgs(compose(ctx), { cwd: action.basePath(), - args: [...opts, spec.service], + args, log, - streamLogs: { ctx }, + streamLogs: { ctx, print: true }, }) return {