chore(docker): update build system with Docker for Windows support (#283)

pull/284/head
Anthony Lapenna 2016-10-26 09:04:26 +13:00 committed by GitHub
parent c3cf5b5f9d
commit d0954abe29
5 changed files with 61 additions and 11 deletions

View File

@ -8,9 +8,15 @@ if [[ $# -ne 1 ]] ; then
fi fi
grunt release grunt release
rm -rf /tmp/portainer-build && mkdir -pv /tmp/portainer-build/portainer rm -rf /tmp/portainer-build-unix && mkdir -pv /tmp/portainer-build-unix/portainer
mv dist/* /tmp/portainer-build/portainer mv dist/* /tmp/portainer-build-unix/portainer
cd /tmp/portainer-build cd /tmp/portainer-build-unix && tar cvpfz portainer-${VERSION}-linux-amd64.tar.gz portainer
tar cvpfz portainer-${VERSION}.tar.gz portainer cd -
grunt release-win
rm -rf /tmp/portainer-build-win && mkdir -pv /tmp/portainer-build-win/portainer
mv dist/* /tmp/portainer-build-win/portainer
cd /tmp/portainer-build-win
tar cvpfz portainer-${VERSION}-windows-amd64.tar.gz portainer
exit 0 exit 0

View File

@ -0,0 +1,9 @@
FROM golang:windowsservercore
COPY dist /
WORKDIR /
EXPOSE 9000
ENTRYPOINT ["/portainer.exe"]

View File

@ -0,0 +1,9 @@
FROM golang:nanoserver
COPY dist /
WORKDIR /
EXPOSE 9000
ENTRYPOINT ["/portainer.exe"]

View File

@ -16,7 +16,7 @@ module.exports = function (grunt) {
grunt.registerTask('default', ['jshint', 'build', 'karma:unit']); grunt.registerTask('default', ['jshint', 'build', 'karma:unit']);
grunt.registerTask('build', [ grunt.registerTask('build', [
'clean:app', 'clean:app',
'if:binaryNotExist', 'if:unixBinaryNotExist',
'html2js', 'html2js',
'concat', 'concat',
'clean:tmpl', 'clean:tmpl',
@ -25,7 +25,19 @@ module.exports = function (grunt) {
]); ]);
grunt.registerTask('release', [ grunt.registerTask('release', [
'clean:all', 'clean:all',
'if:binaryNotExist', 'if:unixBinaryNotExist',
'html2js',
'uglify',
'clean:tmpl',
'jshint',
//'karma:unit',
'concat:index',
'recess:min',
'copy'
]);
grunt.registerTask('release-win', [
'clean:all',
'if:windowsBinaryNotExist',
'html2js', 'html2js',
'uglify', 'uglify',
'clean:tmpl', 'clean:tmpl',
@ -263,6 +275,14 @@ module.exports = function (grunt) {
'mv api/portainer dist/' 'mv api/portainer dist/'
].join(' && ') ].join(' && ')
}, },
buildWindowsBinary: {
command: [
'docker run --rm -v $(pwd)/api:/src -e BUILD_GOOS="windows" -e BUILD_GOARCH="amd64" centurylink/golang-builder-cross',
'shasum api/portainer-windows-amd64 > portainer-checksum.txt',
'mkdir -p dist',
'mv api/portainer-windows-amd64 dist/portainer.exe'
].join(' && ')
},
run: { run: {
command: [ command: [
'docker stop portainer', 'docker stop portainer',
@ -289,11 +309,17 @@ module.exports = function (grunt) {
} }
}, },
'if': { 'if': {
binaryNotExist: { unixBinaryNotExist: {
options: { options: {
executable: 'dist/portainer' executable: 'dist/portainer'
}, },
ifFalse: ['shell:buildBinary'] ifFalse: ['shell:buildBinary']
},
windowsBinaryNotExist: {
options: {
executable: 'dist/portainer.exe'
},
ifFalse: ['shell:buildWindowsBinary']
} }
} }
}); });