mirror of https://github.com/portainer/portainer
chore(docker): update build system with Docker for Windows support (#283)
parent
c3cf5b5f9d
commit
d0954abe29
14
build.sh
14
build.sh
|
@ -8,9 +8,15 @@ if [[ $# -ne 1 ]] ; then
|
|||
fi
|
||||
|
||||
grunt release
|
||||
rm -rf /tmp/portainer-build && mkdir -pv /tmp/portainer-build/portainer
|
||||
mv dist/* /tmp/portainer-build/portainer
|
||||
cd /tmp/portainer-build
|
||||
tar cvpfz portainer-${VERSION}.tar.gz portainer
|
||||
rm -rf /tmp/portainer-build-unix && mkdir -pv /tmp/portainer-build-unix/portainer
|
||||
mv dist/* /tmp/portainer-build-unix/portainer
|
||||
cd /tmp/portainer-build-unix && tar cvpfz portainer-${VERSION}-linux-amd64.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
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
FROM golang:windowsservercore
|
||||
|
||||
COPY dist /
|
||||
|
||||
WORKDIR /
|
||||
|
||||
EXPOSE 9000
|
||||
|
||||
ENTRYPOINT ["/portainer.exe"]
|
|
@ -0,0 +1,9 @@
|
|||
FROM golang:nanoserver
|
||||
|
||||
COPY dist /
|
||||
|
||||
WORKDIR /
|
||||
|
||||
EXPOSE 9000
|
||||
|
||||
ENTRYPOINT ["/portainer.exe"]
|
40
gruntFile.js
40
gruntFile.js
|
@ -16,7 +16,7 @@ module.exports = function (grunt) {
|
|||
grunt.registerTask('default', ['jshint', 'build', 'karma:unit']);
|
||||
grunt.registerTask('build', [
|
||||
'clean:app',
|
||||
'if:binaryNotExist',
|
||||
'if:unixBinaryNotExist',
|
||||
'html2js',
|
||||
'concat',
|
||||
'clean:tmpl',
|
||||
|
@ -25,7 +25,19 @@ module.exports = function (grunt) {
|
|||
]);
|
||||
grunt.registerTask('release', [
|
||||
'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',
|
||||
'uglify',
|
||||
'clean:tmpl',
|
||||
|
@ -263,6 +275,14 @@ module.exports = function (grunt) {
|
|||
'mv api/portainer dist/'
|
||||
].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: {
|
||||
command: [
|
||||
'docker stop portainer',
|
||||
|
@ -289,11 +309,17 @@ module.exports = function (grunt) {
|
|||
}
|
||||
},
|
||||
'if': {
|
||||
binaryNotExist: {
|
||||
options: {
|
||||
executable: 'dist/portainer'
|
||||
},
|
||||
ifFalse: ['shell:buildBinary']
|
||||
unixBinaryNotExist: {
|
||||
options: {
|
||||
executable: 'dist/portainer'
|
||||
},
|
||||
ifFalse: ['shell:buildBinary']
|
||||
},
|
||||
windowsBinaryNotExist: {
|
||||
options: {
|
||||
executable: 'dist/portainer.exe'
|
||||
},
|
||||
ifFalse: ['shell:buildWindowsBinary']
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue