2016-06-04 16:41:35 +00:00
|
|
|
import * as plugins from "./npmci.plugins"
|
2016-06-04 23:31:21 +00:00
|
|
|
import * as NpmciEnv from "./npmci.env";
|
|
|
|
|
|
|
|
|
2016-06-04 16:41:35 +00:00
|
|
|
export let build = function(){
|
|
|
|
let done = plugins.q.defer();
|
|
|
|
done.resolve();
|
|
|
|
return done.promise;
|
|
|
|
}
|
|
|
|
|
2016-06-05 00:17:55 +00:00
|
|
|
let readDockerfiles = function(){
|
|
|
|
plugins.gulp.dest("./Dockerfile*")
|
|
|
|
.pipe(makeDockerfiles);
|
|
|
|
};
|
|
|
|
|
|
|
|
let makeDockerfiles = function(){
|
|
|
|
return function(file,enc,cb){
|
|
|
|
NpmciEnv.dockerFiles.push(
|
|
|
|
new Dockerfile({
|
|
|
|
filePath:file.path,
|
|
|
|
read:true
|
|
|
|
})
|
|
|
|
);
|
|
|
|
};
|
|
|
|
}
|
2016-06-04 23:22:04 +00:00
|
|
|
|
2016-06-05 00:17:55 +00:00
|
|
|
export class Dockerfile {
|
2016-06-04 23:31:21 +00:00
|
|
|
repo:string;
|
|
|
|
version:string;
|
|
|
|
baseImage:string;
|
2016-06-05 00:17:55 +00:00
|
|
|
constructor(options:{filePath?:string,fileContents?:string|Buffer,read?:boolean}){
|
|
|
|
if(options.filePath && options.read){
|
|
|
|
|
|
|
|
}
|
2016-06-04 23:31:21 +00:00
|
|
|
};
|
|
|
|
build(){
|
|
|
|
|
|
|
|
};
|
2016-06-05 00:17:55 +00:00
|
|
|
push(){
|
|
|
|
|
|
|
|
}
|
2016-06-04 23:31:21 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export let dockerTagVersion = function(){
|
|
|
|
if(process.env.CI_BUILD_STAGE == "test"){
|
|
|
|
return "test";
|
|
|
|
} else {
|
|
|
|
return "latest"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export let tagDocker = function(){
|
|
|
|
return NpmciEnv.dockerRegistry + "/" + NpmciEnv.repo.user + "/" + NpmciEnv.repo.repo + ":" + dockerTagVersion() +" .";
|
|
|
|
}
|
2016-06-04 23:22:04 +00:00
|
|
|
|
2016-06-04 23:31:21 +00:00
|
|
|
export let dockerTagTest = function(){
|
|
|
|
return NpmciEnv.dockerRegistry + "/" + NpmciEnv.repo.user + "/" + NpmciEnv.repo.repo + ":test .";
|
|
|
|
}
|
|
|
|
|
|
|
|
export let dockerTagRelease = function(){
|
|
|
|
return NpmciEnv.dockerRegistry + "/" + NpmciEnv.repo.user + "/" + NpmciEnv.repo.repo + ":latest .";
|
|
|
|
}
|