mirror of https://github.com/portainer/portainer
chore(build-system): add support for linux 386 architecture (#871)
parent
a2e781fb3f
commit
6e95e1279a
18
build.sh
18
build.sh
|
@ -38,36 +38,42 @@ mkdir -pv /tmp/portainer-builds
|
||||||
|
|
||||||
PLATFORM="linux"
|
PLATFORM="linux"
|
||||||
ARCH="amd64"
|
ARCH="amd64"
|
||||||
grunt release
|
grunt release-${PLATFORM}-${ARCH}
|
||||||
|
build_and_push_images ${PLATFORM} ${ARCH}
|
||||||
|
build_archive ${PLATFORM} ${ARCH}
|
||||||
|
|
||||||
|
PLATFORM="linux"
|
||||||
|
ARCH="386"
|
||||||
|
grunt release-${PLATFORM}-${ARCH}
|
||||||
build_and_push_images ${PLATFORM} ${ARCH}
|
build_and_push_images ${PLATFORM} ${ARCH}
|
||||||
build_archive ${PLATFORM} ${ARCH}
|
build_archive ${PLATFORM} ${ARCH}
|
||||||
|
|
||||||
PLATFORM="linux"
|
PLATFORM="linux"
|
||||||
ARCH="arm"
|
ARCH="arm"
|
||||||
grunt release-arm
|
grunt release-${PLATFORM}-${ARCH}
|
||||||
build_and_push_images ${PLATFORM} ${ARCH}
|
build_and_push_images ${PLATFORM} ${ARCH}
|
||||||
build_archive ${PLATFORM} ${ARCH}
|
build_archive ${PLATFORM} ${ARCH}
|
||||||
|
|
||||||
PLATFORM="linux"
|
PLATFORM="linux"
|
||||||
ARCH="arm64"
|
ARCH="arm64"
|
||||||
grunt release-arm64
|
grunt release-${PLATFORM}-${ARCH}
|
||||||
build_and_push_images ${PLATFORM} ${ARCH}
|
build_and_push_images ${PLATFORM} ${ARCH}
|
||||||
build_archive ${PLATFORM} ${ARCH}
|
build_archive ${PLATFORM} ${ARCH}
|
||||||
|
|
||||||
PLATFORM="linux"
|
PLATFORM="linux"
|
||||||
ARCH="ppc64le"
|
ARCH="ppc64le"
|
||||||
grunt release-ppc64le
|
grunt release-${PLATFORM}-${ARCH}
|
||||||
build_and_push_images ${PLATFORM} ${ARCH}
|
build_and_push_images ${PLATFORM} ${ARCH}
|
||||||
build_archive ${PLATFORM} ${ARCH}
|
build_archive ${PLATFORM} ${ARCH}
|
||||||
|
|
||||||
PLATFORM="darwin"
|
PLATFORM="darwin"
|
||||||
ARCH="amd64"
|
ARCH="amd64"
|
||||||
grunt release-macos
|
grunt release-${PLATFORM}-${ARCH}
|
||||||
build_archive ${PLATFORM} ${ARCH}
|
build_archive ${PLATFORM} ${ARCH}
|
||||||
|
|
||||||
PLATFORM="windows"
|
PLATFORM="windows"
|
||||||
ARCH="amd64"
|
ARCH="amd64"
|
||||||
grunt release-win
|
grunt release-${PLATFORM}-${ARCH}
|
||||||
build_archive ${PLATFORM} ${ARCH}
|
build_archive ${PLATFORM} ${ARCH}
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
94
gruntfile.js
94
gruntfile.js
|
@ -16,12 +16,11 @@ module.exports = function (grunt) {
|
||||||
grunt.loadNpmTasks('grunt-replace');
|
grunt.loadNpmTasks('grunt-replace');
|
||||||
grunt.loadNpmTasks('grunt-config');
|
grunt.loadNpmTasks('grunt-config');
|
||||||
|
|
||||||
// Default task.
|
|
||||||
grunt.registerTask('default', ['eslint', 'build']);
|
grunt.registerTask('default', ['eslint', 'build']);
|
||||||
grunt.registerTask('build', [
|
grunt.registerTask('build', [
|
||||||
'config:dev',
|
'config:dev',
|
||||||
'clean:app',
|
'clean:app',
|
||||||
'if:unixBinaryNotExist',
|
'if:linuxAmd64BinaryNotExist',
|
||||||
'html2js',
|
'html2js',
|
||||||
'useminPrepare:dev',
|
'useminPrepare:dev',
|
||||||
'recess:build',
|
'recess:build',
|
||||||
|
@ -33,10 +32,10 @@ module.exports = function (grunt) {
|
||||||
'usemin',
|
'usemin',
|
||||||
'clean:tmp'
|
'clean:tmp'
|
||||||
]);
|
]);
|
||||||
grunt.registerTask('release', [
|
grunt.registerTask('release-linux-386', [
|
||||||
'config:prod',
|
'config:prod',
|
||||||
'clean:all',
|
'clean:all',
|
||||||
'if:unixBinaryNotExist',
|
'if:linux386BinaryNotExist',
|
||||||
'html2js',
|
'html2js',
|
||||||
'useminPrepare:release',
|
'useminPrepare:release',
|
||||||
'recess:build',
|
'recess:build',
|
||||||
|
@ -50,10 +49,27 @@ module.exports = function (grunt) {
|
||||||
'usemin',
|
'usemin',
|
||||||
'clean:tmp'
|
'clean:tmp'
|
||||||
]);
|
]);
|
||||||
grunt.registerTask('release-win', [
|
grunt.registerTask('release-linux-amd64', [
|
||||||
'config:prod',
|
'config:prod',
|
||||||
'clean:all',
|
'clean:all',
|
||||||
'if:windowsBinaryNotExist',
|
'if:linuxAmd64BinaryNotExist',
|
||||||
|
'html2js',
|
||||||
|
'useminPrepare:release',
|
||||||
|
'recess:build',
|
||||||
|
'concat',
|
||||||
|
'clean:tmpl',
|
||||||
|
'cssmin',
|
||||||
|
'replace',
|
||||||
|
'uglify',
|
||||||
|
'copy:assets',
|
||||||
|
'filerev',
|
||||||
|
'usemin',
|
||||||
|
'clean:tmp'
|
||||||
|
]);
|
||||||
|
grunt.registerTask('release-linux-arm', [
|
||||||
|
'config:prod',
|
||||||
|
'clean:all',
|
||||||
|
'if:linuxArmBinaryNotExist',
|
||||||
'html2js',
|
'html2js',
|
||||||
'useminPrepare:release',
|
'useminPrepare:release',
|
||||||
'recess:build',
|
'recess:build',
|
||||||
|
@ -67,10 +83,10 @@ module.exports = function (grunt) {
|
||||||
'usemin',
|
'usemin',
|
||||||
'clean:tmp'
|
'clean:tmp'
|
||||||
]);
|
]);
|
||||||
grunt.registerTask('release-arm', [
|
grunt.registerTask('release-linux-arm64', [
|
||||||
'config:prod',
|
'config:prod',
|
||||||
'clean:all',
|
'clean:all',
|
||||||
'if:unixArmBinaryNotExist',
|
'if:linuxArm64BinaryNotExist',
|
||||||
'html2js',
|
'html2js',
|
||||||
'useminPrepare:release',
|
'useminPrepare:release',
|
||||||
'recess:build',
|
'recess:build',
|
||||||
|
@ -84,10 +100,10 @@ module.exports = function (grunt) {
|
||||||
'usemin',
|
'usemin',
|
||||||
'clean:tmp'
|
'clean:tmp'
|
||||||
]);
|
]);
|
||||||
grunt.registerTask('release-arm64', [
|
grunt.registerTask('release-linux-ppc64le', [
|
||||||
'config:prod',
|
'config:prod',
|
||||||
'clean:all',
|
'clean:all',
|
||||||
'if:unixArm64BinaryNotExist',
|
'if:linuxPpc64leBinaryNotExist',
|
||||||
'html2js',
|
'html2js',
|
||||||
'useminPrepare:release',
|
'useminPrepare:release',
|
||||||
'recess:build',
|
'recess:build',
|
||||||
|
@ -101,10 +117,10 @@ module.exports = function (grunt) {
|
||||||
'usemin',
|
'usemin',
|
||||||
'clean:tmp'
|
'clean:tmp'
|
||||||
]);
|
]);
|
||||||
grunt.registerTask('release-macos', [
|
grunt.registerTask('release-windows-amd64', [
|
||||||
'config:prod',
|
'config:prod',
|
||||||
'clean:all',
|
'clean:all',
|
||||||
'if:darwinBinaryNotExist',
|
'if:windowsAmd64BinaryNotExist',
|
||||||
'html2js',
|
'html2js',
|
||||||
'useminPrepare:release',
|
'useminPrepare:release',
|
||||||
'recess:build',
|
'recess:build',
|
||||||
|
@ -118,10 +134,10 @@ module.exports = function (grunt) {
|
||||||
'usemin',
|
'usemin',
|
||||||
'clean:tmp'
|
'clean:tmp'
|
||||||
]);
|
]);
|
||||||
grunt.registerTask('release-ppc64le', [
|
grunt.registerTask('release-darwin-amd64', [
|
||||||
'config:prod',
|
'config:prod',
|
||||||
'clean:all',
|
'clean:all',
|
||||||
'if:unixPpc64leBinaryNotExist',
|
'if:darwinAmd64BinaryNotExist',
|
||||||
'html2js',
|
'html2js',
|
||||||
'useminPrepare:release',
|
'useminPrepare:release',
|
||||||
'recess:build',
|
'recess:build',
|
||||||
|
@ -384,7 +400,7 @@ module.exports = function (grunt) {
|
||||||
buildImage: {
|
buildImage: {
|
||||||
command: 'docker build --rm -t portainer -f build/linux/Dockerfile .'
|
command: 'docker build --rm -t portainer -f build/linux/Dockerfile .'
|
||||||
},
|
},
|
||||||
buildBinary: {
|
buildLinuxAmd64Binary: {
|
||||||
command: [
|
command: [
|
||||||
'docker run --rm -v $(pwd)/api:/src portainer/golang-builder /src/cmd/portainer',
|
'docker run --rm -v $(pwd)/api:/src portainer/golang-builder /src/cmd/portainer',
|
||||||
'shasum api/cmd/portainer/portainer > portainer-checksum.txt',
|
'shasum api/cmd/portainer/portainer > portainer-checksum.txt',
|
||||||
|
@ -392,7 +408,15 @@ module.exports = function (grunt) {
|
||||||
'mv api/cmd/portainer/portainer dist/'
|
'mv api/cmd/portainer/portainer dist/'
|
||||||
].join(' && ')
|
].join(' && ')
|
||||||
},
|
},
|
||||||
buildUnixArmBinary: {
|
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: {
|
||||||
command: [
|
command: [
|
||||||
'docker run --rm -v $(pwd)/api:/src -e BUILD_GOOS="linux" -e BUILD_GOARCH="arm" portainer/golang-builder:cross-platform /src/cmd/portainer',
|
'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',
|
'shasum api/cmd/portainer/portainer-linux-arm > portainer-checksum.txt',
|
||||||
|
@ -400,7 +424,7 @@ module.exports = function (grunt) {
|
||||||
'mv api/cmd/portainer/portainer-linux-arm dist/portainer'
|
'mv api/cmd/portainer/portainer-linux-arm dist/portainer'
|
||||||
].join(' && ')
|
].join(' && ')
|
||||||
},
|
},
|
||||||
buildUnixArm64Binary: {
|
buildLinuxArm64Binary: {
|
||||||
command: [
|
command: [
|
||||||
'docker run --rm -v $(pwd)/api:/src -e BUILD_GOOS="linux" -e BUILD_GOARCH="arm64" portainer/golang-builder:cross-platform /src/cmd/portainer',
|
'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',
|
'shasum api/cmd/portainer/portainer-linux-arm64 > portainer-checksum.txt',
|
||||||
|
@ -408,7 +432,7 @@ module.exports = function (grunt) {
|
||||||
'mv api/cmd/portainer/portainer-linux-arm64 dist/portainer'
|
'mv api/cmd/portainer/portainer-linux-arm64 dist/portainer'
|
||||||
].join(' && ')
|
].join(' && ')
|
||||||
},
|
},
|
||||||
buildUnixPpc64leBinary: {
|
buildLinuxPpc64leBinary: {
|
||||||
command: [
|
command: [
|
||||||
'docker run --rm -v $(pwd)/api:/src -e BUILD_GOOS="linux" -e BUILD_GOARCH="ppc64le" portainer/golang-builder:cross-platform /src/cmd/portainer',
|
'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',
|
'shasum api/cmd/portainer/portainer-linux-ppc64le > portainer-checksum.txt',
|
||||||
|
@ -416,7 +440,7 @@ module.exports = function (grunt) {
|
||||||
'mv api/cmd/portainer/portainer-linux-ppc64le dist/portainer'
|
'mv api/cmd/portainer/portainer-linux-ppc64le dist/portainer'
|
||||||
].join(' && ')
|
].join(' && ')
|
||||||
},
|
},
|
||||||
buildDarwinBinary: {
|
buildDarwinAmd64Binary: {
|
||||||
command: [
|
command: [
|
||||||
'docker run --rm -v $(pwd)/api:/src -e BUILD_GOOS="darwin" -e BUILD_GOARCH="amd64" portainer/golang-builder:cross-platform /src/cmd/portainer',
|
'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',
|
'shasum api/cmd/portainer/portainer-darwin-amd64 > portainer-checksum.txt',
|
||||||
|
@ -424,7 +448,7 @@ module.exports = function (grunt) {
|
||||||
'mv api/cmd/portainer/portainer-darwin-amd64 dist/portainer'
|
'mv api/cmd/portainer/portainer-darwin-amd64 dist/portainer'
|
||||||
].join(' && ')
|
].join(' && ')
|
||||||
},
|
},
|
||||||
buildWindowsBinary: {
|
buildWindowsAmd64Binary: {
|
||||||
command: [
|
command: [
|
||||||
'docker run --rm -v $(pwd)/api:/src -e BUILD_GOOS="windows" -e BUILD_GOARCH="amd64" portainer/golang-builder:cross-platform /src/cmd/portainer',
|
'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',
|
'shasum api/cmd/portainer/portainer-windows-amd64 > portainer-checksum.txt',
|
||||||
|
@ -465,41 +489,47 @@ module.exports = function (grunt) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'if': {
|
'if': {
|
||||||
unixBinaryNotExist: {
|
linuxAmd64BinaryNotExist: {
|
||||||
options: {
|
options: {
|
||||||
executable: 'dist/portainer'
|
executable: 'dist/portainer'
|
||||||
},
|
},
|
||||||
ifFalse: ['shell:buildBinary']
|
ifFalse: ['shell:buildLinuxAmd64Binary']
|
||||||
},
|
},
|
||||||
unixArmBinaryNotExist: {
|
linux386BinaryNotExist: {
|
||||||
options: {
|
options: {
|
||||||
executable: 'dist/portainer'
|
executable: 'dist/portainer'
|
||||||
},
|
},
|
||||||
ifFalse: ['shell:buildUnixArmBinary']
|
ifFalse: ['shell:buildLinux386Binary']
|
||||||
},
|
},
|
||||||
unixArm64BinaryNotExist: {
|
linuxArmBinaryNotExist: {
|
||||||
options: {
|
options: {
|
||||||
executable: 'dist/portainer'
|
executable: 'dist/portainer'
|
||||||
},
|
},
|
||||||
ifFalse: ['shell:buildUnixArm64Binary']
|
ifFalse: ['shell:buildLinuxArmBinary']
|
||||||
},
|
},
|
||||||
unixPpc64leBinaryNotExist: {
|
linuxArm64BinaryNotExist: {
|
||||||
options: {
|
options: {
|
||||||
executable: 'dist/portainer'
|
executable: 'dist/portainer'
|
||||||
},
|
},
|
||||||
ifFalse: ['shell:buildUnixPpc64leBinary']
|
ifFalse: ['shell:buildLinuxArm64Binary']
|
||||||
},
|
},
|
||||||
darwinBinaryNotExist: {
|
linuxPpc64leBinaryNotExist: {
|
||||||
options: {
|
options: {
|
||||||
executable: 'dist/portainer'
|
executable: 'dist/portainer'
|
||||||
},
|
},
|
||||||
ifFalse: ['shell:buildDarwinBinary']
|
ifFalse: ['shell:buildLinuxPpc64leBinary']
|
||||||
},
|
},
|
||||||
windowsBinaryNotExist: {
|
darwinAmd64BinaryNotExist: {
|
||||||
|
options: {
|
||||||
|
executable: 'dist/portainer'
|
||||||
|
},
|
||||||
|
ifFalse: ['shell:buildDarwinAmd64Binary']
|
||||||
|
},
|
||||||
|
windowsAmd64BinaryNotExist: {
|
||||||
options: {
|
options: {
|
||||||
executable: 'dist/portainer.exe'
|
executable: 'dist/portainer.exe'
|
||||||
},
|
},
|
||||||
ifFalse: ['shell:buildWindowsBinary']
|
ifFalse: ['shell:buildWindowsAmd64Binary']
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
replace: {
|
replace: {
|
||||||
|
|
Loading…
Reference in New Issue