mirror of https://github.com/portainer/portainer
chore(build-system): add support for ppc64le architecture (#870)
parent
69c7f116b1
commit
a2e781fb3f
92
build.sh
92
build.sh
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
ARCHIVE_BUILD_FOLDER="/tmp/portainer-builds"
|
||||||
VERSION=$1
|
VERSION=$1
|
||||||
|
|
||||||
if [[ $# -ne 1 ]] ; then
|
if [[ $# -ne 1 ]] ; then
|
||||||
|
@ -7,57 +8,66 @@ if [[ $# -ne 1 ]] ; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# parameters platform, architecture
|
||||||
|
function build_and_push_images() {
|
||||||
|
PLATFORM=$1
|
||||||
|
ARCH=$2
|
||||||
|
|
||||||
|
docker build -t portainer/portainer:${PLATFORM}-${ARCH}-${VERSION} -f build/linux/Dockerfile .
|
||||||
|
docker push portainer/portainer:${PLATFORM}-${ARCH}-${VERSION}
|
||||||
|
docker build -t portainer/portainer:${PLATFORM}-${ARCH} -f build/linux/Dockerfile .
|
||||||
|
docker push portainer/portainer:${PLATFORM}-${ARCH}
|
||||||
|
}
|
||||||
|
|
||||||
|
# parameters: platform, architecture
|
||||||
|
function build_archive() {
|
||||||
|
PLATFORM=$1
|
||||||
|
ARCH=$2
|
||||||
|
|
||||||
|
BUILD_FOLDER=${ARCHIVE_BUILD_FOLDER}/${PLATFORM}-${ARCH}
|
||||||
|
|
||||||
|
rm -rf ${BUILD_FOLDER} && mkdir -pv ${BUILD_FOLDER}/portainer
|
||||||
|
mv dist/* ${BUILD_FOLDER}/portainer/
|
||||||
|
cd ${BUILD_FOLDER}
|
||||||
|
tar cvpfz portainer-${VERSION}-${PLATFORM}-${ARCH}.tar.gz portainer
|
||||||
|
mv portainer-${VERSION}-${PLATFORM}-${ARCH}.tar.gz ${ARCHIVE_BUILD_FOLDER}/
|
||||||
|
cd -
|
||||||
|
}
|
||||||
|
|
||||||
mkdir -pv /tmp/portainer-builds
|
mkdir -pv /tmp/portainer-builds
|
||||||
|
|
||||||
|
PLATFORM="linux"
|
||||||
|
ARCH="amd64"
|
||||||
grunt release
|
grunt release
|
||||||
docker build -t portainer/portainer:linux-amd64-${VERSION} -f build/linux/Dockerfile .
|
build_and_push_images ${PLATFORM} ${ARCH}
|
||||||
docker push portainer/portainer:linux-amd64-${VERSION}
|
build_archive ${PLATFORM} ${ARCH}
|
||||||
docker build -t portainer/portainer:linux-amd64 -f build/linux/Dockerfile .
|
|
||||||
docker push portainer/portainer:linux-amd64
|
|
||||||
rm -rf /tmp/portainer-builds/unix && mkdir -pv /tmp/portainer-builds/unix/portainer
|
|
||||||
mv dist/* /tmp/portainer-builds/unix/portainer
|
|
||||||
cd /tmp/portainer-builds/unix
|
|
||||||
tar cvpfz portainer-${VERSION}-linux-amd64.tar.gz portainer
|
|
||||||
mv portainer-${VERSION}-linux-amd64.tar.gz /tmp/portainer-builds/
|
|
||||||
cd -
|
|
||||||
|
|
||||||
|
PLATFORM="linux"
|
||||||
|
ARCH="arm"
|
||||||
grunt release-arm
|
grunt release-arm
|
||||||
docker build -t portainer/portainer:linux-arm-${VERSION} -f build/linux/Dockerfile .
|
build_and_push_images ${PLATFORM} ${ARCH}
|
||||||
docker push portainer/portainer:linux-arm-${VERSION}
|
build_archive ${PLATFORM} ${ARCH}
|
||||||
docker build -t portainer/portainer:linux-arm -f build/linux/Dockerfile .
|
|
||||||
docker push portainer/portainer:linux-arm
|
|
||||||
rm -rf /tmp/portainer-builds/arm && mkdir -pv /tmp/portainer-builds/arm/portainer
|
|
||||||
mv dist/* /tmp/portainer-builds/arm/portainer
|
|
||||||
cd /tmp/portainer-builds/arm
|
|
||||||
tar cvpfz portainer-${VERSION}-linux-arm.tar.gz portainer
|
|
||||||
mv portainer-${VERSION}-linux-arm.tar.gz /tmp/portainer-builds/
|
|
||||||
cd -
|
|
||||||
|
|
||||||
|
PLATFORM="linux"
|
||||||
|
ARCH="arm64"
|
||||||
grunt release-arm64
|
grunt release-arm64
|
||||||
docker build -t portainer/portainer:linux-arm64-${VERSION} -f build/linux/Dockerfile .
|
build_and_push_images ${PLATFORM} ${ARCH}
|
||||||
docker push portainer/portainer:linux-arm64-${VERSION}
|
build_archive ${PLATFORM} ${ARCH}
|
||||||
docker build -t portainer/portainer:linux-arm64 -f build/linux/Dockerfile .
|
|
||||||
docker push portainer/portainer:linux-arm64
|
|
||||||
rm -rf /tmp/portainer-builds/arm64 && mkdir -pv /tmp/portainer-builds/arm64/portainer
|
|
||||||
mv dist/* /tmp/portainer-builds/arm64/portainer
|
|
||||||
cd /tmp/portainer-builds/arm64
|
|
||||||
tar cvpfz portainer-${VERSION}-linux-arm64.tar.gz portainer
|
|
||||||
mv portainer-${VERSION}-linux-arm64.tar.gz /tmp/portainer-builds/
|
|
||||||
cd -
|
|
||||||
|
|
||||||
|
PLATFORM="linux"
|
||||||
|
ARCH="ppc64le"
|
||||||
|
grunt release-ppc64le
|
||||||
|
build_and_push_images ${PLATFORM} ${ARCH}
|
||||||
|
build_archive ${PLATFORM} ${ARCH}
|
||||||
|
|
||||||
|
PLATFORM="darwin"
|
||||||
|
ARCH="amd64"
|
||||||
grunt release-macos
|
grunt release-macos
|
||||||
rm -rf /tmp/portainer-builds/darwin && mkdir -pv /tmp/portainer-builds/darwin/portainer
|
build_archive ${PLATFORM} ${ARCH}
|
||||||
mv dist/* /tmp/portainer-builds/darwin/portainer
|
|
||||||
cd /tmp/portainer-builds/darwin
|
|
||||||
tar cvpfz portainer-${VERSION}-darwin-amd64.tar.gz portainer
|
|
||||||
mv portainer-${VERSION}-darwin-amd64.tar.gz /tmp/portainer-builds/
|
|
||||||
cd -
|
|
||||||
|
|
||||||
|
PLATFORM="windows"
|
||||||
|
ARCH="amd64"
|
||||||
grunt release-win
|
grunt release-win
|
||||||
rm -rf /tmp/portainer-builds/win && mkdir -pv /tmp/portainer-builds/win/portainer
|
build_archive ${PLATFORM} ${ARCH}
|
||||||
cp -r dist/* /tmp/portainer-builds/win/portainer
|
|
||||||
cd /tmp/portainer-builds/win
|
|
||||||
tar cvpfz portainer-${VERSION}-windows-amd64.tar.gz portainer
|
|
||||||
mv portainer-${VERSION}-windows-amd64.tar.gz /tmp/portainer-builds/
|
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
31
gruntfile.js
31
gruntfile.js
|
@ -118,6 +118,23 @@ module.exports = function (grunt) {
|
||||||
'usemin',
|
'usemin',
|
||||||
'clean:tmp'
|
'clean:tmp'
|
||||||
]);
|
]);
|
||||||
|
grunt.registerTask('release-ppc64le', [
|
||||||
|
'config:prod',
|
||||||
|
'clean:all',
|
||||||
|
'if:unixPpc64leBinaryNotExist',
|
||||||
|
'html2js',
|
||||||
|
'useminPrepare:release',
|
||||||
|
'recess:build',
|
||||||
|
'concat',
|
||||||
|
'clean:tmpl',
|
||||||
|
'cssmin',
|
||||||
|
'replace',
|
||||||
|
'uglify',
|
||||||
|
'copy',
|
||||||
|
'filerev',
|
||||||
|
'usemin',
|
||||||
|
'clean:tmp'
|
||||||
|
]);
|
||||||
grunt.registerTask('lint', ['eslint']);
|
grunt.registerTask('lint', ['eslint']);
|
||||||
grunt.registerTask('run', ['if:unixBinaryNotExist', 'build', 'shell:buildImage', 'shell:run']);
|
grunt.registerTask('run', ['if:unixBinaryNotExist', 'build', 'shell:buildImage', 'shell:run']);
|
||||||
grunt.registerTask('run-swarm', ['if:unixBinaryNotExist', 'build', 'shell:buildImage', 'shell:runSwarm', 'watch:buildSwarm']);
|
grunt.registerTask('run-swarm', ['if:unixBinaryNotExist', 'build', 'shell:buildImage', 'shell:runSwarm', 'watch:buildSwarm']);
|
||||||
|
@ -391,6 +408,14 @@ 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: {
|
||||||
|
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(' && ')
|
||||||
|
},
|
||||||
buildDarwinBinary: {
|
buildDarwinBinary: {
|
||||||
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',
|
||||||
|
@ -458,6 +483,12 @@ module.exports = function (grunt) {
|
||||||
},
|
},
|
||||||
ifFalse: ['shell:buildUnixArm64Binary']
|
ifFalse: ['shell:buildUnixArm64Binary']
|
||||||
},
|
},
|
||||||
|
unixPpc64leBinaryNotExist: {
|
||||||
|
options: {
|
||||||
|
executable: 'dist/portainer'
|
||||||
|
},
|
||||||
|
ifFalse: ['shell:buildUnixPpc64leBinary']
|
||||||
|
},
|
||||||
darwinBinaryNotExist: {
|
darwinBinaryNotExist: {
|
||||||
options: {
|
options: {
|
||||||
executable: 'dist/portainer'
|
executable: 'dist/portainer'
|
||||||
|
|
Loading…
Reference in New Issue