container_rocksdb_version.yml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. name: "docker: build rocksdb image by version"
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. rocksdb_version:
  6. description: 'RocksDB git tag or branch to build (e.g. v10.5.1)'
  7. required: true
  8. default: 'v10.5.1'
  9. seaweedfs_ref:
  10. description: 'SeaweedFS git tag, branch, or commit to build'
  11. required: true
  12. default: 'master'
  13. image_tag:
  14. description: 'Optional Docker tag suffix (defaults to rocksdb_<rocksdb>_seaweedfs_<ref>)'
  15. required: false
  16. default: ''
  17. permissions:
  18. contents: read
  19. jobs:
  20. build-rocksdb-image:
  21. runs-on: ubuntu-latest
  22. steps:
  23. - name: Checkout
  24. uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v2
  25. - name: Prepare Docker tag
  26. id: tag
  27. env:
  28. ROCKSDB_VERSION_INPUT: ${{ inputs.rocksdb_version }}
  29. SEAWEEDFS_REF_INPUT: ${{ inputs.seaweedfs_ref }}
  30. CUSTOM_TAG_INPUT: ${{ inputs.image_tag }}
  31. run: |
  32. set -euo pipefail
  33. sanitize() {
  34. local value="$1"
  35. value="${value,,}"
  36. value="${value// /-}"
  37. value="${value//[^a-z0-9_.-]/-}"
  38. value="${value#-}"
  39. value="${value%-}"
  40. printf '%s' "$value"
  41. }
  42. version="${ROCKSDB_VERSION_INPUT}"
  43. seaweed="${SEAWEEDFS_REF_INPUT}"
  44. tag="${CUSTOM_TAG_INPUT}"
  45. if [ -z "$version" ]; then
  46. echo "RocksDB version input is required." >&2
  47. exit 1
  48. fi
  49. if [ -z "$seaweed" ]; then
  50. echo "SeaweedFS ref input is required." >&2
  51. exit 1
  52. fi
  53. sanitized_version="$(sanitize "$version")"
  54. if [ -z "$sanitized_version" ]; then
  55. echo "Unable to sanitize RocksDB version '$version'." >&2
  56. exit 1
  57. fi
  58. sanitized_seaweed="$(sanitize "$seaweed")"
  59. if [ -z "$sanitized_seaweed" ]; then
  60. echo "Unable to sanitize SeaweedFS ref '$seaweed'." >&2
  61. exit 1
  62. fi
  63. if [ -z "$tag" ]; then
  64. tag="rocksdb_${sanitized_version}_seaweedfs_${sanitized_seaweed}"
  65. fi
  66. tag="${tag,,}"
  67. tag="${tag// /-}"
  68. tag="${tag//[^a-z0-9_.-]/-}"
  69. tag="${tag#-}"
  70. tag="${tag%-}"
  71. if [ -z "$tag" ]; then
  72. echo "Resulting Docker tag is empty." >&2
  73. exit 1
  74. fi
  75. echo "docker_tag=$tag" >> "$GITHUB_OUTPUT"
  76. echo "full_image=chrislusf/seaweedfs:$tag" >> "$GITHUB_OUTPUT"
  77. echo "seaweedfs_ref=$seaweed" >> "$GITHUB_OUTPUT"
  78. - name: Set up QEMU
  79. uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v1
  80. - name: Set up Docker Buildx
  81. uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v1
  82. - name: Login to Docker Hub
  83. uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v1
  84. with:
  85. username: ${{ secrets.DOCKER_USERNAME }}
  86. password: ${{ secrets.DOCKER_PASSWORD }}
  87. - name: Build and push image
  88. uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v2
  89. with:
  90. context: ./docker
  91. push: true
  92. file: ./docker/Dockerfile.rocksdb_large
  93. build-args: |
  94. ROCKSDB_VERSION=${{ inputs.rocksdb_version }}
  95. BRANCH=${{ inputs.seaweedfs_ref }}
  96. platforms: linux/amd64
  97. tags: ${{ steps.tag.outputs.full_image }}
  98. labels: |
  99. org.opencontainers.image.title=seaweedfs
  100. org.opencontainers.image.description=SeaweedFS is a distributed storage system for blobs, objects, files, and data lake, to store and serve billions of files fast!
  101. org.opencontainers.image.vendor=Chris Lu