Skip to content

Commit 374f0bf

Browse files
feat(dist:Dockerfile): initial add dist Dockerfile
Add functionality to add Dockerfile to dist folder in the same way as the heroku Procfile is created No docker integration to build image Closes angular-fullstack#1531
1 parent 70d3117 commit 374f0bf

File tree

5 files changed

+52
-2
lines changed

5 files changed

+52
-2
lines changed

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

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

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ gulp.task('build', cb => {
497497
cb);
498498
});
499499

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

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

Diff for: 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: docker/index.js

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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.conflicter.resolve(function (err) {
23+
done();
24+
});
25+
};
26+
27+
Generator.prototype.gruntBuild = function gruntBuild() {
28+
if(this.abort) return;
29+
var done = this.async();
30+
31+
this.log(chalk.bold('\nBuilding dist folder, please wait...'));
32+
var child = exec('grunt build', function (err, stdout) {
33+
done();
34+
}.bind(this));
35+
child.stdout.on('data', function(data) {
36+
this.log(data.toString());
37+
}.bind(this));
38+
};
39+
40+

Diff for: 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+

0 commit comments

Comments
 (0)