From ab62b979bd6cc75fe927da1a6ac42db0566caf39 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Sun, 5 Jun 2016 02:17:55 +0200 Subject: [PATCH] start on getting some class logic to Docker --- package.json | 1 + ts/npmci.build.docker.ts | 26 +++++++++++++++++++++++--- ts/npmci.env.ts | 5 +++-- ts/npmci.plugins.ts | 1 + ts/npmci.publish.ts | 6 ------ 5 files changed, 28 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 0f99214..c5c46cb 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "smartfile": "^3.0.10", "smartssh": "^1.0.5", "smartstring": "^2.0.4", + "through2": "^2.0.1", "typings-global": "^1.0.3" } } diff --git a/ts/npmci.build.docker.ts b/ts/npmci.build.docker.ts index 3f5172f..ebd0b5c 100644 --- a/ts/npmci.build.docker.ts +++ b/ts/npmci.build.docker.ts @@ -8,17 +8,37 @@ export let build = function(){ return done.promise; } +let readDockerfiles = function(){ + plugins.gulp.dest("./Dockerfile*") + .pipe(makeDockerfiles); +}; -class Dockerfile { +let makeDockerfiles = function(){ + return function(file,enc,cb){ + NpmciEnv.dockerFiles.push( + new Dockerfile({ + filePath:file.path, + read:true + }) + ); + }; +} + +export class Dockerfile { repo:string; version:string; baseImage:string; - constructor(){ - + constructor(options:{filePath?:string,fileContents?:string|Buffer,read?:boolean}){ + if(options.filePath && options.read){ + + } }; build(){ }; + push(){ + + } } diff --git a/ts/npmci.env.ts b/ts/npmci.env.ts index bcc9ff6..c4c0e6a 100644 --- a/ts/npmci.env.ts +++ b/ts/npmci.env.ts @@ -1,7 +1,7 @@ import "typings-global"; import * as plugins from "./npmci.plugins"; - import {GitRepo} from "smartstring"; +import {Dockerfile} from "./npmci.build.docker" export let repo = new GitRepo(process.env.CI_BUILD_REPO); export let dockerTestTag:string; @@ -9,4 +9,5 @@ export let dockerReleaseTag:string; export let dockerRegistry; // will be set by npmci.prepare export let dockerImages; -export let dockerFiles; \ No newline at end of file +export let dockerFiles:Dockerfile[]; + diff --git a/ts/npmci.plugins.ts b/ts/npmci.plugins.ts index 986dc1d..413dbb3 100644 --- a/ts/npmci.plugins.ts +++ b/ts/npmci.plugins.ts @@ -2,6 +2,7 @@ import "typings-global"; export import beautylog = require("beautylog"); export let commander = require("commander"); export let gulp = require("gulp"); +export let path = require("path"); export let q = require("q"); export let request = require("request"); export let shelljs = require("shelljs"); diff --git a/ts/npmci.publish.ts b/ts/npmci.publish.ts index 5ef3e91..1687769 100644 --- a/ts/npmci.publish.ts +++ b/ts/npmci.publish.ts @@ -26,11 +26,5 @@ let publishNpm = function(){ let publishDocker = function(){ let done = plugins.q.defer(); - prepare("docker") - .then(function(){ - bash - bash("docker push " + env.dockerTag()); - done.resolve(); - }); return done.promise; }; \ No newline at end of file