more docker
This commit is contained in:
parent
ab62b979bd
commit
a38996b98c
@ -21,17 +21,22 @@ let makeDockerfiles = function(){
|
|||||||
read:true
|
read:true
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
cb();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Dockerfile {
|
export class Dockerfile {
|
||||||
repo:string;
|
repo:string;
|
||||||
version:string;
|
version:string;
|
||||||
|
content:string;
|
||||||
baseImage:string;
|
baseImage:string;
|
||||||
constructor(options:{filePath?:string,fileContents?:string|Buffer,read?:boolean}){
|
constructor(options:{filePath?:string,fileContents?:string|Buffer,read?:boolean}){
|
||||||
|
this.repo = NpmciEnv.repo.user + "/" + NpmciEnv.repo.repo;
|
||||||
|
this.version = dockerFileVersion(plugins.path.parse(options.filePath).base);
|
||||||
if(options.filePath && options.read){
|
if(options.filePath && options.read){
|
||||||
|
this.content = plugins.smartfile.local.toStringSync(plugins.path.resolve(options.filePath));
|
||||||
}
|
};
|
||||||
|
this.baseImage = dockerBaseImage(this.content);
|
||||||
};
|
};
|
||||||
build(){
|
build(){
|
||||||
|
|
||||||
@ -39,7 +44,24 @@ export class Dockerfile {
|
|||||||
push(){
|
push(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let dockerFileVersion = function(dockerfileNameArg:string):string{
|
||||||
|
let versionString:string;
|
||||||
|
let versionRegex = /Dockerfile_([a-zA-Z0-9\.]*)$/;
|
||||||
|
let regexResultArray = versionRegex.exec(dockerfileNameArg);
|
||||||
|
if(regexResultArray.length = 2){
|
||||||
|
versionString = regexResultArray[1];
|
||||||
|
} else {
|
||||||
|
versionString = "latest";
|
||||||
|
}
|
||||||
|
return versionString;
|
||||||
|
}
|
||||||
|
|
||||||
|
let dockerBaseImage = function(dockerfileContentArg:string){
|
||||||
|
let baseImageRegex = /FROM\s([a-zA-z0-9\/\-\:]*)\n/
|
||||||
|
let regexResultArray = baseImageRegex.exec(dockerfileContentArg)
|
||||||
|
return regexResultArray[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
export let dockerTagVersion = function(){
|
export let dockerTagVersion = function(){
|
||||||
@ -48,16 +70,4 @@ export let dockerTagVersion = function(){
|
|||||||
} else {
|
} else {
|
||||||
return "latest"
|
return "latest"
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export let tagDocker = function(){
|
|
||||||
return NpmciEnv.dockerRegistry + "/" + NpmciEnv.repo.user + "/" + NpmciEnv.repo.repo + ":" + dockerTagVersion() +" .";
|
|
||||||
}
|
|
||||||
|
|
||||||
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 .";
|
|
||||||
}
|
|
||||||
|
@ -2,10 +2,10 @@ import "typings-global";
|
|||||||
export import beautylog = require("beautylog");
|
export import beautylog = require("beautylog");
|
||||||
export let commander = require("commander");
|
export let commander = require("commander");
|
||||||
export let gulp = require("gulp");
|
export let gulp = require("gulp");
|
||||||
export let path = require("path");
|
export import path = require("path");
|
||||||
export let q = require("q");
|
export let q = require("q");
|
||||||
export let request = require("request");
|
export let request = require("request");
|
||||||
export let shelljs = require("shelljs");
|
export let shelljs = require("shelljs");
|
||||||
export let smartssh = require("smartssh");
|
export import smartssh = require("smartssh");
|
||||||
export import smartstring = require("smartstring");
|
export import smartstring = require("smartstring");
|
||||||
export import smartfile = require("smartfile");
|
export import smartfile = require("smartfile");
|
Loading…
Reference in New Issue
Block a user