diff --git a/apps/api/src/lib/common.ts b/apps/api/src/lib/common.ts index 48f1f97b4..1c598dcbf 100644 --- a/apps/api/src/lib/common.ts +++ b/apps/api/src/lib/common.ts @@ -500,6 +500,7 @@ export async function createRemoteEngineConfiguration(id: string) { return await fs.writeFile(`${homedir}/.ssh/config`, sshConfig.stringify(config)) } export async function executeDockerCmd({ debug, buildId, applicationId, dockerId, command }: { debug?: boolean, buildId?: string, applicationId?: string, dockerId: string, command: string }): Promise { + const { execaCommand } = await import('execa') let { remoteEngine, remoteIpAddress, engine } = await prisma.destinationDocker.findUnique({ where: { id: dockerId } }) if (remoteEngine) { await createRemoteEngineConfiguration(dockerId) @@ -515,10 +516,7 @@ export async function executeDockerCmd({ debug, buildId, applicationId, dockerId if (command.startsWith(`docker build --progress plain`)) { return await asyncExecShellStream({ debug, buildId, applicationId, command, engine }); } - return await asyncExecShell( - `DOCKER_BUILDKIT=1 DOCKER_HOST="${engine}" ${command}` - ); - + return await execaCommand(command, { env: { DOCKER_BUILDKIT: "1", DOCKER_HOST: engine }, shell: true }) } export async function startTraefikProxy(id: string): Promise { const { engine, network, remoteEngine, remoteIpAddress } = await prisma.destinationDocker.findUnique({ where: { id } })