2017-07-04 12:30:23 +00:00
|
|
|
var autoprefixer = require('autoprefixer');
|
|
|
|
var cssnano = require('cssnano');
|
|
|
|
|
2016-12-30 23:20:38 +00:00
|
|
|
module.exports = function (grunt) {
|
|
|
|
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
2017-05-04 08:17:55 +00:00
|
|
|
grunt.loadNpmTasks('gruntify-eslint');
|
2016-12-30 23:20:38 +00:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-clean');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-copy');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
|
|
|
grunt.loadNpmTasks('grunt-html2js');
|
|
|
|
grunt.loadNpmTasks('grunt-shell');
|
|
|
|
grunt.loadNpmTasks('grunt-if');
|
|
|
|
grunt.loadNpmTasks('grunt-filerev');
|
|
|
|
grunt.loadNpmTasks('grunt-usemin');
|
2017-02-13 22:39:26 +00:00
|
|
|
grunt.loadNpmTasks('grunt-replace');
|
2017-05-19 15:48:03 +00:00
|
|
|
grunt.loadNpmTasks('grunt-config');
|
2017-07-04 12:30:23 +00:00
|
|
|
grunt.loadNpmTasks('grunt-postcss');
|
2016-12-30 23:20:38 +00:00
|
|
|
|
2017-05-04 08:17:55 +00:00
|
|
|
grunt.registerTask('default', ['eslint', 'build']);
|
2016-12-30 23:20:38 +00:00
|
|
|
grunt.registerTask('build', [
|
2017-05-19 15:48:03 +00:00
|
|
|
'config:dev',
|
2016-12-30 23:20:38 +00:00
|
|
|
'clean:app',
|
2017-05-20 08:27:55 +00:00
|
|
|
'if:linuxAmd64BinaryNotExist',
|
2016-12-30 23:20:38 +00:00
|
|
|
'html2js',
|
|
|
|
'useminPrepare:dev',
|
|
|
|
'concat',
|
|
|
|
'clean:tmpl',
|
2017-05-19 15:48:03 +00:00
|
|
|
'replace',
|
2016-12-30 23:20:38 +00:00
|
|
|
'copy',
|
|
|
|
'filerev',
|
|
|
|
'usemin',
|
|
|
|
'clean:tmp'
|
|
|
|
]);
|
2017-05-23 13:33:40 +00:00
|
|
|
grunt.registerTask('build-webapp', [
|
|
|
|
'config:prod',
|
|
|
|
'clean:all',
|
|
|
|
'html2js',
|
|
|
|
'useminPrepare:release',
|
|
|
|
'concat',
|
2017-07-04 12:30:23 +00:00
|
|
|
'postcss:build',
|
2017-05-23 13:33:40 +00:00
|
|
|
'clean:tmpl',
|
|
|
|
'replace',
|
|
|
|
'uglify',
|
|
|
|
'copy:assets',
|
|
|
|
'filerev',
|
|
|
|
'usemin',
|
|
|
|
'clean:tmp'
|
|
|
|
]);
|
2017-05-20 08:27:55 +00:00
|
|
|
grunt.registerTask('release-linux-386', [
|
2017-05-19 15:48:03 +00:00
|
|
|
'config:prod',
|
2017-01-02 18:47:12 +00:00
|
|
|
'clean:all',
|
2017-05-20 08:27:55 +00:00
|
|
|
'if:linux386BinaryNotExist',
|
2016-12-30 23:20:38 +00:00
|
|
|
'html2js',
|
|
|
|
'useminPrepare:release',
|
|
|
|
'concat',
|
2017-07-04 12:30:23 +00:00
|
|
|
'postcss:build',
|
2016-12-30 23:20:38 +00:00
|
|
|
'clean:tmpl',
|
2017-05-19 15:48:03 +00:00
|
|
|
'replace',
|
2016-12-30 23:20:38 +00:00
|
|
|
'uglify',
|
|
|
|
'copy:assets',
|
|
|
|
'filerev',
|
|
|
|
'usemin',
|
2017-05-19 15:48:03 +00:00
|
|
|
'clean:tmp'
|
2016-12-30 23:20:38 +00:00
|
|
|
]);
|
2017-05-20 08:27:55 +00:00
|
|
|
grunt.registerTask('release-linux-amd64', [
|
2017-05-19 15:48:03 +00:00
|
|
|
'config:prod',
|
2017-01-02 18:47:12 +00:00
|
|
|
'clean:all',
|
2017-05-20 08:27:55 +00:00
|
|
|
'if:linuxAmd64BinaryNotExist',
|
|
|
|
'html2js',
|
|
|
|
'useminPrepare:release',
|
|
|
|
'concat',
|
2017-07-04 12:30:23 +00:00
|
|
|
'postcss:build',
|
2017-05-20 08:27:55 +00:00
|
|
|
'clean:tmpl',
|
|
|
|
'replace',
|
|
|
|
'uglify',
|
|
|
|
'copy:assets',
|
|
|
|
'filerev',
|
|
|
|
'usemin',
|
|
|
|
'clean:tmp'
|
|
|
|
]);
|
|
|
|
grunt.registerTask('release-linux-arm', [
|
|
|
|
'config:prod',
|
|
|
|
'clean:all',
|
|
|
|
'if:linuxArmBinaryNotExist',
|
2016-12-30 23:20:38 +00:00
|
|
|
'html2js',
|
2017-05-19 15:48:03 +00:00
|
|
|
'useminPrepare:release',
|
2016-12-30 23:20:38 +00:00
|
|
|
'concat',
|
2017-07-04 12:30:23 +00:00
|
|
|
'postcss:build',
|
2016-12-30 23:20:38 +00:00
|
|
|
'clean:tmpl',
|
2017-05-19 15:48:03 +00:00
|
|
|
'replace',
|
2016-12-30 23:20:38 +00:00
|
|
|
'uglify',
|
|
|
|
'copy',
|
|
|
|
'filerev',
|
|
|
|
'usemin',
|
2017-05-19 15:48:03 +00:00
|
|
|
'clean:tmp'
|
2016-12-30 23:20:38 +00:00
|
|
|
]);
|
2017-05-20 08:27:55 +00:00
|
|
|
grunt.registerTask('release-linux-arm64', [
|
2017-05-19 15:48:03 +00:00
|
|
|
'config:prod',
|
2017-01-02 18:47:12 +00:00
|
|
|
'clean:all',
|
2017-05-20 08:27:55 +00:00
|
|
|
'if:linuxArm64BinaryNotExist',
|
2016-12-30 23:20:38 +00:00
|
|
|
'html2js',
|
2017-05-19 15:48:03 +00:00
|
|
|
'useminPrepare:release',
|
2016-12-30 23:20:38 +00:00
|
|
|
'concat',
|
2017-07-04 12:30:23 +00:00
|
|
|
'postcss:build',
|
2016-12-30 23:20:38 +00:00
|
|
|
'clean:tmpl',
|
2017-05-19 15:48:03 +00:00
|
|
|
'replace',
|
2016-12-30 23:20:38 +00:00
|
|
|
'uglify',
|
|
|
|
'copy',
|
|
|
|
'filerev',
|
|
|
|
'usemin',
|
2017-05-19 15:48:03 +00:00
|
|
|
'clean:tmp'
|
2016-12-30 23:20:38 +00:00
|
|
|
]);
|
2017-05-20 08:27:55 +00:00
|
|
|
grunt.registerTask('release-linux-ppc64le', [
|
2017-05-19 15:48:03 +00:00
|
|
|
'config:prod',
|
2017-01-02 18:47:12 +00:00
|
|
|
'clean:all',
|
2017-05-20 08:27:55 +00:00
|
|
|
'if:linuxPpc64leBinaryNotExist',
|
2017-01-02 18:42:21 +00:00
|
|
|
'html2js',
|
2017-05-19 15:48:03 +00:00
|
|
|
'useminPrepare:release',
|
2017-01-02 18:42:21 +00:00
|
|
|
'concat',
|
2017-07-04 12:30:23 +00:00
|
|
|
'postcss:build',
|
2017-01-02 18:42:21 +00:00
|
|
|
'clean:tmpl',
|
2017-05-19 15:48:03 +00:00
|
|
|
'replace',
|
2017-01-02 18:42:21 +00:00
|
|
|
'uglify',
|
|
|
|
'copy',
|
|
|
|
'filerev',
|
|
|
|
'usemin',
|
2017-05-19 15:48:03 +00:00
|
|
|
'clean:tmp'
|
2017-01-02 18:42:21 +00:00
|
|
|
]);
|
2017-05-20 08:27:55 +00:00
|
|
|
grunt.registerTask('release-windows-amd64', [
|
2017-05-19 15:48:03 +00:00
|
|
|
'config:prod',
|
2017-01-02 18:47:12 +00:00
|
|
|
'clean:all',
|
2017-05-20 08:27:55 +00:00
|
|
|
'if:windowsAmd64BinaryNotExist',
|
2016-12-30 23:20:38 +00:00
|
|
|
'html2js',
|
2017-05-19 15:48:03 +00:00
|
|
|
'useminPrepare:release',
|
2016-12-30 23:20:38 +00:00
|
|
|
'concat',
|
2017-07-04 12:30:23 +00:00
|
|
|
'postcss:build',
|
2016-12-30 23:20:38 +00:00
|
|
|
'clean:tmpl',
|
2017-05-19 15:48:03 +00:00
|
|
|
'replace',
|
2016-12-30 23:20:38 +00:00
|
|
|
'uglify',
|
|
|
|
'copy',
|
|
|
|
'filerev',
|
|
|
|
'usemin',
|
2017-05-19 15:48:03 +00:00
|
|
|
'clean:tmp'
|
2016-12-30 23:20:38 +00:00
|
|
|
]);
|
2017-05-20 08:27:55 +00:00
|
|
|
grunt.registerTask('release-darwin-amd64', [
|
2017-05-20 08:02:18 +00:00
|
|
|
'config:prod',
|
|
|
|
'clean:all',
|
2017-05-20 08:27:55 +00:00
|
|
|
'if:darwinAmd64BinaryNotExist',
|
2017-05-20 08:02:18 +00:00
|
|
|
'html2js',
|
|
|
|
'useminPrepare:release',
|
|
|
|
'concat',
|
2017-07-04 12:30:23 +00:00
|
|
|
'postcss:build',
|
2017-05-20 08:02:18 +00:00
|
|
|
'clean:tmpl',
|
|
|
|
'replace',
|
|
|
|
'uglify',
|
|
|
|
'copy',
|
|
|
|
'filerev',
|
|
|
|
'usemin',
|
|
|
|
'clean:tmp'
|
|
|
|
]);
|
2017-05-04 08:17:55 +00:00
|
|
|
grunt.registerTask('lint', ['eslint']);
|
2017-05-23 18:56:10 +00:00
|
|
|
grunt.registerTask('run', ['if:linuxAmd64BinaryNotExist', 'build', 'shell:buildImage', 'shell:run']);
|
2017-07-08 08:42:41 +00:00
|
|
|
grunt.registerTask('run-dev', ['if:linuxAmd64BinaryNotExist', 'shell:run', 'watch:build']);
|
2016-12-30 23:20:38 +00:00
|
|
|
grunt.registerTask('clear', ['clean:app']);
|
|
|
|
|
|
|
|
// Print a timestamp (useful for when watching)
|
|
|
|
grunt.registerTask('timestamp', function () {
|
|
|
|
grunt.log.subhead(Date());
|
|
|
|
});
|
|
|
|
|
|
|
|
// Project configuration.
|
|
|
|
grunt.initConfig({
|
|
|
|
distdir: 'dist',
|
|
|
|
pkg: grunt.file.readJSON('package.json'),
|
2017-05-19 15:48:03 +00:00
|
|
|
config: {
|
|
|
|
dev: {
|
|
|
|
options: {
|
|
|
|
variables: {
|
|
|
|
'environment': 'development'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
prod: {
|
|
|
|
options: {
|
|
|
|
variables: {
|
|
|
|
'environment': 'production'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2016-12-30 23:20:38 +00:00
|
|
|
src: {
|
|
|
|
js: ['app/**/*.js', '!app/**/*.spec.js'],
|
|
|
|
jsTpl: ['<%= distdir %>/templates/**/*.js'],
|
|
|
|
jsVendor: [
|
|
|
|
'bower_components/jquery/dist/jquery.min.js',
|
|
|
|
'bower_components/bootstrap/dist/js/bootstrap.min.js',
|
|
|
|
'bower_components/Chart.js/Chart.min.js',
|
|
|
|
'bower_components/lodash/dist/lodash.min.js',
|
2017-02-10 05:11:00 +00:00
|
|
|
'bower_components/splitargs/src/splitargs.js',
|
2016-12-30 23:20:38 +00:00
|
|
|
'bower_components/filesize/lib/filesize.min.js',
|
|
|
|
'bower_components/moment/min/moment.min.js',
|
|
|
|
'bower_components/xterm.js/dist/xterm.js',
|
2017-02-15 22:14:56 +00:00
|
|
|
'bower_components/bootbox.js/bootbox.js',
|
2017-05-23 18:56:10 +00:00
|
|
|
'bower_components/angular-multi-select/isteven-multi-select.js',
|
2017-04-12 19:47:22 +00:00
|
|
|
'bower_components/toastr/toastr.min.js',
|
2016-12-30 23:20:38 +00:00
|
|
|
'assets/js/legend.js' // Not a bower package
|
|
|
|
],
|
|
|
|
html: ['index.html'],
|
2017-06-20 11:00:32 +00:00
|
|
|
tpl: ['app/components/**/*.html', 'app/directives/**/*.html'],
|
2016-12-30 23:20:38 +00:00
|
|
|
css: ['assets/css/app.css'],
|
|
|
|
cssVendor: [
|
|
|
|
'bower_components/bootstrap/dist/css/bootstrap.css',
|
|
|
|
'bower_components/font-awesome/css/font-awesome.min.css',
|
|
|
|
'bower_components/rdash-ui/dist/css/rdash.min.css',
|
|
|
|
'bower_components/angular-ui-select/dist/select.min.css',
|
2017-04-12 19:47:22 +00:00
|
|
|
'bower_components/xterm.js/dist/xterm.css',
|
2017-05-23 18:56:10 +00:00
|
|
|
'bower_components/angular-multi-select/isteven-multi-select.css',
|
2017-04-12 19:47:22 +00:00
|
|
|
'bower_components/toastr/toastr.min.css'
|
2016-12-30 23:20:38 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
clean: {
|
|
|
|
all: ['<%= distdir %>/*'],
|
|
|
|
app: ['<%= distdir %>/*', '!<%= distdir %>/portainer'],
|
|
|
|
tmpl: ['<%= distdir %>/templates'],
|
|
|
|
tmp: ['<%= distdir %>/js/*', '!<%= distdir %>/js/app.*.js', '<%= distdir %>/css/*', '!<%= distdir %>/css/app.*.css']
|
|
|
|
},
|
|
|
|
useminPrepare: {
|
|
|
|
dev: {
|
|
|
|
src: '<%= src.html %>',
|
|
|
|
options: {
|
|
|
|
root: '<%= distdir %>',
|
|
|
|
flow: {
|
|
|
|
steps: {
|
|
|
|
js: ['concat'],
|
|
|
|
css: ['concat']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
release: {
|
|
|
|
src: '<%= src.html %>',
|
|
|
|
options: {
|
2016-12-31 00:27:35 +00:00
|
|
|
root: '<%= distdir %>'
|
2016-12-30 23:20:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
filerev: {
|
|
|
|
files: {
|
|
|
|
src: ['<%= distdir %>/js/*.js', '<%= distdir %>/css/*.css']
|
|
|
|
}
|
|
|
|
},
|
|
|
|
usemin: {
|
2016-12-31 00:27:35 +00:00
|
|
|
html: ['<%= distdir %>/index.html']
|
2016-12-30 23:20:38 +00:00
|
|
|
},
|
|
|
|
copy: {
|
|
|
|
bundle: {
|
|
|
|
files: [
|
|
|
|
{
|
|
|
|
dest: '<%= distdir %>/js/',
|
|
|
|
src: ['app.js'],
|
|
|
|
expand: true,
|
|
|
|
cwd: '.tmp/concat/js/'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
dest: '<%= distdir %>/css/',
|
|
|
|
src: ['app.css'],
|
|
|
|
expand: true,
|
|
|
|
cwd: '.tmp/concat/css/'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
assets: {
|
|
|
|
files: [
|
|
|
|
{dest: '<%= distdir %>/fonts/', src: '*.{ttf,woff,woff2,eof,svg}', expand: true, cwd: 'bower_components/bootstrap/fonts/'},
|
|
|
|
{dest: '<%= distdir %>/fonts/', src: '*.{ttf,woff,woff2,eof,svg}', expand: true, cwd: 'bower_components/font-awesome/fonts/'},
|
|
|
|
{dest: '<%= distdir %>/fonts/', src: '*.{ttf,woff,woff2,eof,svg}', expand: true, cwd: 'bower_components/rdash-ui/dist/fonts/'},
|
|
|
|
{
|
|
|
|
dest: '<%= distdir %>/images/',
|
|
|
|
src: ['**'],
|
|
|
|
expand: true,
|
|
|
|
cwd: 'assets/images/'
|
|
|
|
},
|
|
|
|
{dest: '<%= distdir %>/ico', src: '**', expand: true, cwd: 'assets/ico'}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
html2js: {
|
|
|
|
app: {
|
|
|
|
options: {
|
|
|
|
base: '.'
|
|
|
|
},
|
|
|
|
src: ['<%= src.tpl %>'],
|
|
|
|
dest: '<%= distdir %>/templates/app.js',
|
|
|
|
module: '<%= pkg.name %>.templates'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
concat: {
|
2017-07-04 12:30:23 +00:00
|
|
|
css: {
|
|
|
|
src: ['<%= src.cssVendor %>', '<%= src.css %>'],
|
|
|
|
dest: '<%= distdir %>/css/<%= pkg.name %>.css'
|
|
|
|
},
|
2016-12-30 23:20:38 +00:00
|
|
|
dist: {
|
|
|
|
options: {
|
|
|
|
process: true
|
|
|
|
},
|
|
|
|
src: ['<%= src.js %>', '<%= src.jsTpl %>'],
|
|
|
|
dest: '<%= distdir %>/js/<%= pkg.name %>.js'
|
|
|
|
},
|
|
|
|
vendor: {
|
|
|
|
src: ['<%= src.jsVendor %>'],
|
|
|
|
dest: '<%= distdir %>/js/vendor.js'
|
|
|
|
},
|
|
|
|
index: {
|
|
|
|
src: ['index.html'],
|
|
|
|
dest: '<%= distdir %>/index.html',
|
|
|
|
options: {
|
|
|
|
process: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
angular: {
|
|
|
|
src: ['bower_components/angular/angular.min.js',
|
|
|
|
'bower_components/angular-sanitize/angular-sanitize.min.js',
|
|
|
|
'bower_components/angular-cookies/angular-cookies.min.js',
|
|
|
|
'bower_components/angular-local-storage/dist/angular-local-storage.min.js',
|
|
|
|
'bower_components/angular-jwt/dist/angular-jwt.min.js',
|
|
|
|
'bower_components/angular-ui-router/release/angular-ui-router.min.js',
|
|
|
|
'bower_components/angular-resource/angular-resource.min.js',
|
|
|
|
'bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js',
|
|
|
|
'bower_components/ng-file-upload/ng-file-upload.min.js',
|
|
|
|
'bower_components/angular-utils-pagination/dirPagination.js',
|
2017-02-13 22:39:26 +00:00
|
|
|
'bower_components/angular-google-analytics/dist/angular-google-analytics.min.js',
|
2016-12-30 23:20:38 +00:00
|
|
|
'bower_components/angular-ui-select/dist/select.min.js'],
|
|
|
|
dest: '<%= distdir %>/js/angular.js'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
uglify: {
|
|
|
|
dist: {
|
|
|
|
src: ['<%= src.js %>', '<%= src.jsTpl %>'],
|
|
|
|
dest: '<%= distdir %>/js/<%= pkg.name %>.js'
|
|
|
|
},
|
|
|
|
vendor: {
|
|
|
|
options: {
|
|
|
|
preserveComments: 'some' // Preserve license comments
|
|
|
|
},
|
|
|
|
src: ['<%= src.jsVendor %>'],
|
|
|
|
dest: '<%= distdir %>/js/vendor.js'
|
|
|
|
},
|
|
|
|
angular: {
|
|
|
|
options: {
|
|
|
|
preserveComments: 'some' // Preserve license comments
|
|
|
|
},
|
|
|
|
src: ['<%= concat.angular.src %>'],
|
|
|
|
dest: '<%= distdir %>/js/angular.js'
|
|
|
|
}
|
|
|
|
},
|
2017-07-04 12:30:23 +00:00
|
|
|
postcss: {
|
2016-12-30 23:20:38 +00:00
|
|
|
build: {
|
|
|
|
options: {
|
2017-07-04 12:30:23 +00:00
|
|
|
processors: [
|
|
|
|
autoprefixer({browsers: 'last 2 versions'}), // add vendor prefixes
|
|
|
|
cssnano() // minify the result
|
|
|
|
]
|
2016-12-30 23:20:38 +00:00
|
|
|
},
|
2017-07-04 12:30:23 +00:00
|
|
|
src: '<%= distdir %>/css/<%= pkg.name %>.css',
|
|
|
|
dest: '<%= distdir %>/css/app.css'
|
2016-12-30 23:20:38 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
all: {
|
|
|
|
files: ['<%= src.js %>', '<%= src.css %>', '<%= src.tpl %>', '<%= src.html %>'],
|
|
|
|
tasks: ['default', 'timestamp']
|
|
|
|
},
|
|
|
|
build: {
|
|
|
|
files: ['<%= src.js %>', '<%= src.css %>', '<%= src.tpl %>', '<%= src.html %>'],
|
2017-07-08 08:42:41 +00:00
|
|
|
tasks: ['build']
|
2016-12-30 23:20:38 +00:00
|
|
|
},
|
|
|
|
buildSwarm: {
|
|
|
|
files: ['<%= src.js %>', '<%= src.css %>', '<%= src.tpl %>', '<%= src.html %>'],
|
|
|
|
tasks: ['build', 'shell:buildImage', 'shell:runSwarm', 'shell:cleanImages']
|
|
|
|
},
|
|
|
|
buildSsl: {
|
|
|
|
files: ['<%= src.js %>', '<%= src.css %>', '<%= src.tpl %>', '<%= src.html %>'],
|
|
|
|
tasks: ['build', 'shell:buildImage', 'shell:runSsl', 'shell:cleanImages']
|
|
|
|
}
|
|
|
|
},
|
2017-05-04 08:17:55 +00:00
|
|
|
eslint: {
|
|
|
|
src: ['gruntfile.js', '<%= src.js %>'],
|
2016-12-30 23:20:38 +00:00
|
|
|
options: {
|
2017-05-04 08:17:55 +00:00
|
|
|
configFile: '.eslintrc.yml'
|
|
|
|
}
|
2016-12-30 23:20:38 +00:00
|
|
|
},
|
|
|
|
shell: {
|
|
|
|
buildImage: {
|
|
|
|
command: 'docker build --rm -t portainer -f build/linux/Dockerfile .'
|
|
|
|
},
|
2017-05-20 08:27:55 +00:00
|
|
|
buildLinuxAmd64Binary: {
|
2016-12-30 23:20:38 +00:00
|
|
|
command: [
|
|
|
|
'docker run --rm -v $(pwd)/api:/src portainer/golang-builder /src/cmd/portainer',
|
|
|
|
'shasum api/cmd/portainer/portainer > portainer-checksum.txt',
|
|
|
|
'mkdir -p dist',
|
|
|
|
'mv api/cmd/portainer/portainer dist/'
|
|
|
|
].join(' && ')
|
|
|
|
},
|
2017-05-20 08:27:55 +00:00
|
|
|
buildLinux386Binary: {
|
|
|
|
command: [
|
|
|
|
'docker run --rm -v $(pwd)/api:/src -e BUILD_GOOS="linux" -e BUILD_GOARCH="386" portainer/golang-builder:cross-platform /src/cmd/portainer',
|
|
|
|
'shasum api/cmd/portainer/portainer-linux-386 > portainer-checksum.txt',
|
|
|
|
'mkdir -p dist',
|
|
|
|
'mv api/cmd/portainer/portainer-linux-386 dist/portainer'
|
|
|
|
].join(' && ')
|
|
|
|
},
|
|
|
|
buildLinuxArmBinary: {
|
2016-12-30 23:20:38 +00:00
|
|
|
command: [
|
|
|
|
'docker run --rm -v $(pwd)/api:/src -e BUILD_GOOS="linux" -e BUILD_GOARCH="arm" portainer/golang-builder:cross-platform /src/cmd/portainer',
|
|
|
|
'shasum api/cmd/portainer/portainer-linux-arm > portainer-checksum.txt',
|
|
|
|
'mkdir -p dist',
|
|
|
|
'mv api/cmd/portainer/portainer-linux-arm dist/portainer'
|
|
|
|
].join(' && ')
|
|
|
|
},
|
2017-05-20 08:27:55 +00:00
|
|
|
buildLinuxArm64Binary: {
|
2017-05-20 08:02:18 +00:00
|
|
|
command: [
|
|
|
|
'docker run --rm -v $(pwd)/api:/src -e BUILD_GOOS="linux" -e BUILD_GOARCH="arm64" portainer/golang-builder:cross-platform /src/cmd/portainer',
|
|
|
|
'shasum api/cmd/portainer/portainer-linux-arm64 > portainer-checksum.txt',
|
|
|
|
'mkdir -p dist',
|
|
|
|
'mv api/cmd/portainer/portainer-linux-arm64 dist/portainer'
|
|
|
|
].join(' && ')
|
|
|
|
},
|
2017-05-20 08:27:55 +00:00
|
|
|
buildLinuxPpc64leBinary: {
|
2017-05-20 08:02:18 +00:00
|
|
|
command: [
|
|
|
|
'docker run --rm -v $(pwd)/api:/src -e BUILD_GOOS="linux" -e BUILD_GOARCH="ppc64le" portainer/golang-builder:cross-platform /src/cmd/portainer',
|
|
|
|
'shasum api/cmd/portainer/portainer-linux-ppc64le > portainer-checksum.txt',
|
|
|
|
'mkdir -p dist',
|
|
|
|
'mv api/cmd/portainer/portainer-linux-ppc64le dist/portainer'
|
|
|
|
].join(' && ')
|
|
|
|
},
|
2017-05-20 08:27:55 +00:00
|
|
|
buildDarwinAmd64Binary: {
|
2016-12-30 23:20:38 +00:00
|
|
|
command: [
|
|
|
|
'docker run --rm -v $(pwd)/api:/src -e BUILD_GOOS="darwin" -e BUILD_GOARCH="amd64" portainer/golang-builder:cross-platform /src/cmd/portainer',
|
|
|
|
'shasum api/cmd/portainer/portainer-darwin-amd64 > portainer-checksum.txt',
|
|
|
|
'mkdir -p dist',
|
|
|
|
'mv api/cmd/portainer/portainer-darwin-amd64 dist/portainer'
|
|
|
|
].join(' && ')
|
|
|
|
},
|
2017-05-20 08:27:55 +00:00
|
|
|
buildWindowsAmd64Binary: {
|
2016-12-30 23:20:38 +00:00
|
|
|
command: [
|
|
|
|
'docker run --rm -v $(pwd)/api:/src -e BUILD_GOOS="windows" -e BUILD_GOARCH="amd64" portainer/golang-builder:cross-platform /src/cmd/portainer',
|
|
|
|
'shasum api/cmd/portainer/portainer-windows-amd64 > portainer-checksum.txt',
|
|
|
|
'mkdir -p dist',
|
|
|
|
'mv api/cmd/portainer/portainer-windows-amd64 dist/portainer.exe'
|
|
|
|
].join(' && ')
|
|
|
|
},
|
|
|
|
run: {
|
|
|
|
command: [
|
|
|
|
'docker stop portainer',
|
|
|
|
'docker rm portainer',
|
2017-07-08 08:42:41 +00:00
|
|
|
'docker run -d -p 9000:9000 -v $(pwd)/dist:/app -v /tmp/portainer:/data -v /var/run/docker.sock:/var/run/docker.sock:z --name portainer centurylink/ca-certs /app/portainer --no-analytics -a /app'
|
2016-12-30 23:20:38 +00:00
|
|
|
].join(';')
|
|
|
|
},
|
|
|
|
cleanImages: {
|
|
|
|
command: 'docker rmi $(docker images -q -f dangling=true)'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'if': {
|
2017-05-20 08:27:55 +00:00
|
|
|
linuxAmd64BinaryNotExist: {
|
|
|
|
options: {
|
|
|
|
executable: 'dist/portainer'
|
|
|
|
},
|
|
|
|
ifFalse: ['shell:buildLinuxAmd64Binary']
|
|
|
|
},
|
|
|
|
linux386BinaryNotExist: {
|
2016-12-30 23:20:38 +00:00
|
|
|
options: {
|
|
|
|
executable: 'dist/portainer'
|
|
|
|
},
|
2017-05-20 08:27:55 +00:00
|
|
|
ifFalse: ['shell:buildLinux386Binary']
|
2016-12-30 23:20:38 +00:00
|
|
|
},
|
2017-05-20 08:27:55 +00:00
|
|
|
linuxArmBinaryNotExist: {
|
2016-12-30 23:20:38 +00:00
|
|
|
options: {
|
|
|
|
executable: 'dist/portainer'
|
|
|
|
},
|
2017-05-20 08:27:55 +00:00
|
|
|
ifFalse: ['shell:buildLinuxArmBinary']
|
2016-12-30 23:20:38 +00:00
|
|
|
},
|
2017-05-20 08:27:55 +00:00
|
|
|
linuxArm64BinaryNotExist: {
|
2017-01-02 18:42:21 +00:00
|
|
|
options: {
|
|
|
|
executable: 'dist/portainer'
|
|
|
|
},
|
2017-05-20 08:27:55 +00:00
|
|
|
ifFalse: ['shell:buildLinuxArm64Binary']
|
2017-01-02 18:42:21 +00:00
|
|
|
},
|
2017-05-20 08:27:55 +00:00
|
|
|
linuxPpc64leBinaryNotExist: {
|
2017-05-20 08:02:18 +00:00
|
|
|
options: {
|
|
|
|
executable: 'dist/portainer'
|
|
|
|
},
|
2017-05-20 08:27:55 +00:00
|
|
|
ifFalse: ['shell:buildLinuxPpc64leBinary']
|
2017-05-20 08:02:18 +00:00
|
|
|
},
|
2017-05-20 08:27:55 +00:00
|
|
|
darwinAmd64BinaryNotExist: {
|
2016-12-30 23:20:38 +00:00
|
|
|
options: {
|
|
|
|
executable: 'dist/portainer'
|
|
|
|
},
|
2017-05-20 08:27:55 +00:00
|
|
|
ifFalse: ['shell:buildDarwinAmd64Binary']
|
2016-12-30 23:20:38 +00:00
|
|
|
},
|
2017-05-20 08:27:55 +00:00
|
|
|
windowsAmd64BinaryNotExist: {
|
2016-12-30 23:20:38 +00:00
|
|
|
options: {
|
|
|
|
executable: 'dist/portainer.exe'
|
|
|
|
},
|
2017-05-20 08:27:55 +00:00
|
|
|
ifFalse: ['shell:buildWindowsAmd64Binary']
|
2016-12-30 23:20:38 +00:00
|
|
|
}
|
2017-02-13 22:39:26 +00:00
|
|
|
},
|
|
|
|
replace: {
|
2017-05-19 15:48:03 +00:00
|
|
|
concat: {
|
2017-02-13 22:39:26 +00:00
|
|
|
options: {
|
|
|
|
patterns: [
|
2017-05-19 15:48:03 +00:00
|
|
|
{
|
|
|
|
match: 'ENVIRONMENT',
|
|
|
|
replacement: '<%= grunt.config.get("environment") %>'
|
|
|
|
},
|
2017-02-13 22:39:26 +00:00
|
|
|
{
|
|
|
|
match: 'CONFIG_GA_ID',
|
|
|
|
replacement: '<%= pkg.config.GA_ID %>'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
files: [
|
|
|
|
{
|
|
|
|
expand: true,
|
|
|
|
flatten: true,
|
2017-05-19 15:48:03 +00:00
|
|
|
src: ['.tmp/concat/js/app.js'],
|
|
|
|
dest: '.tmp/concat/js'
|
2017-02-13 22:39:26 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2016-12-30 23:20:38 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|