start build args implementation

This commit is contained in:
2017-08-28 19:11:24 +02:00
parent 214c523306
commit 37b3c1abc9
8 changed files with 31 additions and 7 deletions

View File

@ -40,7 +40,8 @@ export class Dockerfile {
*/
async build () {
plugins.beautylog.info('now building Dockerfile for ' + this.cleanTag)
let buildCommand = `docker build -t ${this.buildTag} -f ${this.filePath} .`
let buildArgsString = await helpers.getDockerBuildArgs()
let buildCommand = `docker build -t ${this.buildTag} -f ${this.filePath} ${buildArgsString} .`
await bash(buildCommand)
return
}

View File

@ -153,6 +153,15 @@ export let getDockerTagString = (registryArg: string, repoArg: string, versionAr
return tagString
}
export let getDockerBuildArgs = async (): Promise<string> => {
plugins.beautylog.info('checking for env vars to be supplied to the docker build')
let buildArgsString: string = ''
for (let key in NpmciConfig.configObject.dockerEnvBuildargMap) {
// TODO
}
return buildArgsString
}
/**
*
*/

View File

@ -10,6 +10,7 @@ import { KeyValueStore } from 'npmextra'
export interface INpmciOptions {
npmGlobalTools: string[]
dockerRegistryRepoMap: any
dockerEnvBuildargMap: any
}
// instantiate a kvStorage for the current directory
@ -19,7 +20,8 @@ export let kvStorage = new KeyValueStore('custom', `${repo.user}_${repo.repo}`)
let npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd)
let defaultConfig: INpmciOptions = {
npmGlobalTools: [],
dockerRegistryRepoMap: {}
dockerRegistryRepoMap: {},
dockerEnvBuildargMap: {}
}
export let configObject = npmciNpmextra.dataFor<INpmciOptions>('npmci', defaultConfig)