2016-06-02 11:39:03 +00:00
|
|
|
import "typings-global";
|
|
|
|
import * as plugins from "./npmci.plugins";
|
|
|
|
import {bash} from "./npmci.bash";
|
2016-06-03 00:56:20 +00:00
|
|
|
import * as env from "./npmci.env";
|
2016-06-02 11:39:03 +00:00
|
|
|
|
|
|
|
export let build = function(commandArg){
|
2016-06-03 00:10:34 +00:00
|
|
|
switch(commandArg){
|
|
|
|
case "docker":
|
|
|
|
return docker();
|
|
|
|
case "docker-gitlab":
|
|
|
|
return dockerGitlab();
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
let docker = function(){
|
|
|
|
let done = plugins.q.defer();
|
2016-06-03 00:56:20 +00:00
|
|
|
plugins.shelljs.exec("docker build -t " + "registry.gitlab.com/" + env.repo.user + "/" + env.repo.repo + ":latest .");
|
2016-06-03 00:10:34 +00:00
|
|
|
done.resolve();
|
|
|
|
return done.promise;
|
|
|
|
}
|
|
|
|
|
|
|
|
let dockerGitlab = function(){
|
2016-06-02 11:39:03 +00:00
|
|
|
let done = plugins.q.defer();
|
2016-06-02 23:58:37 +00:00
|
|
|
let repo = new plugins.smartstring.GitRepo(process.env.CI_BUILD_REPO);
|
2016-06-03 00:56:20 +00:00
|
|
|
plugins.shelljs.exec("docker build -t " + "registry.gitlab.com/" + env.repo.user + "/" + env.repo.repo + ":latest .");
|
2016-06-02 23:58:37 +00:00
|
|
|
done.resolve();
|
2016-06-02 11:39:03 +00:00
|
|
|
return done.promise;
|
|
|
|
}
|