THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

This is Gitea test Portainer repository mirror from Github
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 
 

49 linhas
1.5 KiB

  1. #!/usr/bin/env bash
  2. ARCHIVE_BUILD_FOLDER="/tmp/portainer-builds"
  3. # parameter: "platform-architecture"
  4. function build_and_push_images() {
  5. docker build -t "portainer/portainer:$1-${VERSION}" -f build/linux/Dockerfile .
  6. docker tag "portainer/portainer:$1-${VERSION}" "portainer/portainer:$1"
  7. docker push "portainer/portainer:$1-${VERSION}"
  8. docker push "portainer/portainer:$1"
  9. }
  10. # parameter: "platform-architecture"
  11. function build_archive() {
  12. BUILD_FOLDER="${ARCHIVE_BUILD_FOLDER}/$1"
  13. rm -rf ${BUILD_FOLDER} && mkdir -pv ${BUILD_FOLDER}/portainer
  14. cp -r dist/* ${BUILD_FOLDER}/portainer/
  15. cd ${BUILD_FOLDER}
  16. tar cvpfz "portainer-${VERSION}-$1.tar.gz" portainer
  17. mv "portainer-${VERSION}-$1.tar.gz" ${ARCHIVE_BUILD_FOLDER}/
  18. cd -
  19. }
  20. function build_all() {
  21. mkdir -pv "${ARCHIVE_BUILD_FOLDER}"
  22. for tag in $@; do
  23. yarn grunt "release:`echo "$tag" | tr '-' ':'`"
  24. name="portainer"; if [ "$(echo "$tag" | cut -c1)" = "w" ]; then name="${name}.exe"; fi
  25. mv dist/portainer-$tag* dist/$name
  26. if [ `echo $tag | cut -d \- -f 1` == 'linux' ]; then build_and_push_images "$tag"; fi
  27. build_archive "$tag"
  28. done
  29. docker rmi $(docker images -q -f dangling=true)
  30. }
  31. if [[ $# -ne 1 ]] ; then
  32. echo "Usage: $(basename $0) <VERSION>"
  33. echo " $(basename $0) \"echo 'Custom' && <BASH COMMANDS>\""
  34. exit 1
  35. else
  36. VERSION="$1"
  37. if [ `echo "$@" | cut -c1-4` == 'echo' ]; then
  38. bash -c "$@";
  39. else
  40. build_all 'linux-amd64 linux-arm linux-arm64 linux-ppc64le linux-s390x darwin-amd64 windows-amd64'
  41. exit 0
  42. fi
  43. fi