Skip to content

Commit 0674ad0

Browse files
docker integration part 1
1 parent d6447d1 commit 0674ad0

File tree

6 files changed

+54
-2
lines changed

6 files changed

+54
-2
lines changed

Diff for: src/generators/app/USAGE

+1
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ Sub Generators:
2222
Deployment:
2323
angular-fullstack:openshift
2424
angular-fullstack:heroku
25+
angular-fullstack:docker

Diff for: src/generators/docker/USAGE

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Description:
2+
Add a Dockerfile to the dist folder.
3+
4+
Example:
5+
yo angular-fullstack:docker
6+
7+
This will create:
8+
a dist folder with a Dockerfile in it

Diff for: src/generators/docker/index.js

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
'use strict';
2+
var util = require('util');
3+
var yeoman = require('yeoman-generator');
4+
var exec = require('child_process').exec;
5+
var chalk = require('chalk');
6+
var path = require('path');
7+
var s = require('underscore.string');
8+
9+
var Generator = module.exports = function Generator() {
10+
yeoman.generators.Base.apply(this, arguments);
11+
this.sourceRoot(path.join(__dirname, './templates'));
12+
this.filters = this.config.get('filters') || {};
13+
};
14+
15+
util.inherits(Generator, yeoman.generators.NamedBase);
16+
17+
Generator.prototype.copyDockerfile = function copyDockerfile() {
18+
if(this.abort) return;
19+
var done = this.async();
20+
this.log(chalk.bold('Creating Dockerfile'));
21+
//this.copy('Dockerfile', 'dist/Dockerfile');
22+
this.fs.copyTpl(this.templatePath('_Dockerfile'), 'dist/Dockerfile', {});
23+
this.conflicter.resolve(function (err) {
24+
done();
25+
});
26+
};
27+
28+
Generator.prototype.gruntBuild = function gruntBuild() {
29+
if(this.abort) return;
30+
var done = this.async();
31+
32+
this.log(chalk.bold('\nBuilding dist folder, please wait...'));
33+
var child = exec('grunt build', function (err, stdout) {
34+
done();
35+
}.bind(this));
36+
child.stdout.on('data', function(data) {
37+
this.log(data.toString());
38+
}.bind(this));
39+
};
40+
41+

Diff for: src/generators/docker/templates/_Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FROM generatorangularfullstack/angular-fullstack-dist:3.3.0
2+

Diff for: templates/app/Gruntfile(grunt).js

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ module.exports = function(grunt) {
198198
dot: true,
199199
src: [
200200
'.tmp',
201-
'<%%= yeoman.dist %>/!(.git*|.openshift|Procfile)**'
201+
'<%%= yeoman.dist %>/!(.git*|.openshift|Procfile|Dockerfile)**'
202202
]
203203
}]
204204
},

Diff for: templates/app/gulpfile.babel(gulp).js

+1-1
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ gulp.task('build', cb => {
572572
cb);
573573
});
574574

575-
gulp.task('clean:dist', () => del([`${paths.dist}/!(.git*|.openshift|Procfile)**`], {dot: true}));
575+
gulp.task('clean:dist', () => del([`${paths.dist}/!(.git*|.openshift|Procfile|Dockerfile)**`], {dot: true}));
576576

577577
gulp.task('build:client', ['styles', 'html', 'constant', 'build:images'], () => {
578578
var manifest = gulp.src(`${paths.dist}/${clientPath}/assets/rev-manifest.json`);

0 commit comments

Comments
 (0)