|
|
|
@ -89,18 +89,17 @@ export async function getInputs(): Promise<Inputs> {
|
|
|
|
export function getDockerfilePath(inputs: Inputs): string | null {
|
|
|
|
export function getDockerfilePath(inputs: Inputs): string | null {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
const context = inputs.context || Context.gitContext();
|
|
|
|
const context = inputs.context || Context.gitContext();
|
|
|
|
const normalizedContext = path.normalize(context);
|
|
|
|
|
|
|
|
let dockerfilePath: string;
|
|
|
|
let dockerfilePath: string;
|
|
|
|
|
|
|
|
|
|
|
|
if (inputs.file) {
|
|
|
|
if (inputs.file) {
|
|
|
|
const normalizedFile = path.normalize(inputs.file);
|
|
|
|
// If context is git context, just use the file path directly
|
|
|
|
dockerfilePath = normalizedFile.startsWith(normalizedContext) ? normalizedFile : path.join(normalizedContext, normalizedFile);
|
|
|
|
dockerfilePath = context === Context.gitContext() ? inputs.file : path.join(path.normalize(context), inputs.file);
|
|
|
|
} else if (inputs['dockerfile']) {
|
|
|
|
} else if (inputs['dockerfile']) {
|
|
|
|
const normalizedDockerfile = path.normalize(inputs['dockerfile']);
|
|
|
|
// If context is git context, just use the dockerfile path directly
|
|
|
|
dockerfilePath = normalizedDockerfile.startsWith(normalizedContext) ? normalizedDockerfile : path.join(normalizedContext, normalizedDockerfile);
|
|
|
|
dockerfilePath = context === Context.gitContext() ? inputs['dockerfile'] : path.join(path.normalize(context), inputs['dockerfile']);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// Default to Dockerfile in the context directory
|
|
|
|
// If context is git context, just use 'Dockerfile'
|
|
|
|
dockerfilePath = path.join(normalizedContext, 'Dockerfile');
|
|
|
|
dockerfilePath = context === Context.gitContext() ? 'Dockerfile' : path.join(path.normalize(context), 'Dockerfile');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Verify the file exists
|
|
|
|
// Verify the file exists
|
|
|
|
|