update docker handling
This commit is contained in:
parent
ddfd314a18
commit
2d5054be0b
@ -3,7 +3,8 @@ import * as paths from "./npmdocker.paths";
|
|||||||
import * as snippets from "./npmdocker.snippets";
|
import * as snippets from "./npmdocker.snippets";
|
||||||
|
|
||||||
let config;
|
let config;
|
||||||
|
let imageTag = "npmdocker-temp-image"
|
||||||
|
let containerName = "npmdocker-temp-container"
|
||||||
/**
|
/**
|
||||||
* check if docker is available
|
* check if docker is available
|
||||||
*/
|
*/
|
||||||
@ -35,7 +36,8 @@ let buildDockerFile = () => {
|
|||||||
*/
|
*/
|
||||||
let buildDockerImage = () => {
|
let buildDockerImage = () => {
|
||||||
let done = plugins.q.defer();
|
let done = plugins.q.defer();
|
||||||
plugins.shelljs(`docker build -f ${paths.dockerfile} -v ${paths.cwd}:/workdir ${paths.assets}`);
|
plugins.shelljs.exec(`docker pull ${config.baseImage}`); // first pull latest version of baseImage
|
||||||
|
plugins.shelljs.exec(`docker build -f ${paths.dockerfile} -v ${paths.cwd}:/workdir -t ${imageTag} ${paths.assets}`);
|
||||||
done.resolve();
|
done.resolve();
|
||||||
return done.promise
|
return done.promise
|
||||||
};
|
};
|
||||||
@ -45,6 +47,7 @@ let buildDockerImage = () => {
|
|||||||
*/
|
*/
|
||||||
let runDockerImage = () => {
|
let runDockerImage = () => {
|
||||||
let done = plugins.q.defer();
|
let done = plugins.q.defer();
|
||||||
|
plugins.shelljs.exec(`docker run --name ${containerName} ${imageTag}`);
|
||||||
return done.promise
|
return done.promise
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user