From 5ec2edbe11af3517cd144d097a22ba0a05522f8d Mon Sep 17 00:00:00 2001 From: Nikola Jokic <97525037+nikola-jokic@users.noreply.github.com> Date: Fri, 3 Jun 2022 15:02:10 +0200 Subject: [PATCH 1/2] err message suggestion Co-authored-by: Thomas Boop <52323235+thboop@users.noreply.github.com> --- packages/docker/src/dockerCommands/container.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/docker/src/dockerCommands/container.ts b/packages/docker/src/dockerCommands/container.ts index 0a4904e..b9ae66e 100644 --- a/packages/docker/src/dockerCommands/container.ts +++ b/packages/docker/src/dockerCommands/container.ts @@ -146,7 +146,7 @@ export async function containerBuild( tag: string ): Promise { if (!args.dockerfile) { - throw new Error('Container build expets args.dockerfile to be set') + throw new Error('Container build expects 'args.dockerfile' to be set') } const dockerArgs: string[] = ['build'] From b0cf60b678c1730545a60e45c0bbaf16954bf598 Mon Sep 17 00:00:00 2001 From: Nikola Jokic Date: Fri, 3 Jun 2022 15:10:14 +0200 Subject: [PATCH 2/2] changed split to dirname and fixed syntax error in err message --- packages/docker/src/dockerCommands/container.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/docker/src/dockerCommands/container.ts b/packages/docker/src/dockerCommands/container.ts index b9ae66e..043d40b 100644 --- a/packages/docker/src/dockerCommands/container.ts +++ b/packages/docker/src/dockerCommands/container.ts @@ -7,6 +7,7 @@ import { ServiceContainerInfo, StepContainerInfo } from 'hooklib/lib' +import * as path from 'path' import { env } from 'process' import { v4 as uuidv4 } from 'uuid' import { runDockerCommand, RunDockerCommandOptions } from '../utils' @@ -146,7 +147,7 @@ export async function containerBuild( tag: string ): Promise { if (!args.dockerfile) { - throw new Error('Container build expects 'args.dockerfile' to be set') + throw new Error("Container build expects 'args.dockerfile' to be set") } const dockerArgs: string[] = ['build'] @@ -160,9 +161,7 @@ export async function containerBuild( } function getBuildContext(dockerfilePath: string): string { - const pathSplit = dockerfilePath.split('/') - pathSplit.splice(pathSplit.length - 1) - return pathSplit.join('/') + return path.dirname(dockerfilePath) } function getWorkingDir(dockerfilePath: string): string {