Added dockerfile path to image label

Signed-off-by: Jyotsna Singh <Josh-01@github.com>
This commit is contained in:
Jyotsna Singh 2020-11-03 17:50:03 +05:30 committed by Jyotsna
parent 6efc2b01cb
commit 720cd8569f
2 changed files with 11 additions and 0 deletions

View file

@ -5,6 +5,7 @@ import * as context from './context';
import * as exec from './exec';
import * as stateHelper from './state-helper';
import * as core from '@actions/core';
import * as github from '@actions/github';
async function run(): Promise<void> {
try {
@ -23,6 +24,12 @@ async function run(): Promise<void> {
const defContext = context.defaultContext();
let inputs: context.Inputs = await context.getInputs(defContext);
//Add dockerfile path to label
let dockerfilePath = core.getInput('file') || 'Dockerfile';
inputs.labels.push(
`org.opencontainers.image.source=https://github.com/${github.context.repo.owner}/${github.context.repo.repo}/${dockerfilePath}`
);
core.info(`🏃 Starting build...`);
const args: string[] = await context.getArgs(inputs, defContext, buildxVersion);
await exec.exec('docker', args).then(res => {