Skip to content

Commit

Permalink
docker integration part 1
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyMarshall committed Jun 6, 2016
1 parent d6447d1 commit 0674ad0
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/generators/app/USAGE
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ Sub Generators:
Deployment:
angular-fullstack:openshift
angular-fullstack:heroku
angular-fullstack:docker
8 changes: 8 additions & 0 deletions src/generators/docker/USAGE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Description:
Add a Dockerfile to the dist folder.

Example:
yo angular-fullstack:docker

This will create:
a dist folder with a Dockerfile in it
41 changes: 41 additions & 0 deletions src/generators/docker/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
'use strict';
var util = require('util');
var yeoman = require('yeoman-generator');
var exec = require('child_process').exec;
var chalk = require('chalk');
var path = require('path');
var s = require('underscore.string');

var Generator = module.exports = function Generator() {
yeoman.generators.Base.apply(this, arguments);
this.sourceRoot(path.join(__dirname, './templates'));
this.filters = this.config.get('filters') || {};
};

util.inherits(Generator, yeoman.generators.NamedBase);

Generator.prototype.copyDockerfile = function copyDockerfile() {
if(this.abort) return;
var done = this.async();
this.log(chalk.bold('Creating Dockerfile'));
//this.copy('Dockerfile', 'dist/Dockerfile');
this.fs.copyTpl(this.templatePath('_Dockerfile'), 'dist/Dockerfile', {});
this.conflicter.resolve(function (err) {
done();
});
};

Generator.prototype.gruntBuild = function gruntBuild() {
if(this.abort) return;

This comment has been minimized.

Copy link
@Awk34

Awk34 Jun 7, 2016

Member

Where's this.abort from?

This comment has been minimized.

Copy link
@JeremyMarshall

JeremyMarshall via email Jun 7, 2016

Author Collaborator

This comment has been minimized.

Copy link
@JeremyMarshall

JeremyMarshall via email Jun 7, 2016

Author Collaborator
var done = this.async();

this.log(chalk.bold('\nBuilding dist folder, please wait...'));
var child = exec('grunt build', function (err, stdout) {
done();
}.bind(this));
child.stdout.on('data', function(data) {
this.log(data.toString());
}.bind(this));
};


2 changes: 2 additions & 0 deletions src/generators/docker/templates/_Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM generatorangularfullstack/angular-fullstack-dist:3.3.0

2 changes: 1 addition & 1 deletion templates/app/Gruntfile(grunt).js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ module.exports = function(grunt) {
dot: true,
src: [
'.tmp',
'<%%= yeoman.dist %>/!(.git*|.openshift|Procfile)**'
'<%%= yeoman.dist %>/!(.git*|.openshift|Procfile|Dockerfile)**'
]
}]
},
Expand Down
2 changes: 1 addition & 1 deletion templates/app/gulpfile.babel(gulp).js
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ gulp.task('build', cb => {
cb);
});

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

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

0 comments on commit 0674ad0

Please sign in to comment.