Update container.yml #12
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "Containers: RocksDB 9/3" | |
| on: | |
| push: | |
| tags: | |
| - '*' | |
| workflow_dispatch: | |
| inputs: | |
| tag_name: | |
| description: 'Tag name for the container' | |
| required: true | |
| default: 'latest' | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-enterprise-rocksdb-9-3: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout artifactory repo | |
| uses: actions/checkout@v4 | |
| - name: Clone private GitLab repo (SeaweedFS Enterprise) | |
| env: | |
| GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} | |
| run: | | |
| git clone -b enterprise https://gitlab-ci-token:${GITLAB_TOKEN}@gitlab.com/chrislusf/seaweedfs.git seaweedfs-enterprise-source | |
| cd seaweedfs-enterprise-source | |
| echo "Cloned enterprise branch commit: $(git rev-parse HEAD)" | |
| echo "COMMIT_SHA=$(git rev-parse --short=8 HEAD)" >> $GITHUB_ENV | |
| - name: Change shard counts from 10/4 to 9/3 | |
| run: | | |
| set -euo pipefail | |
| TARGET="seaweedfs-enterprise-source/weed/storage/erasure_coding/ec_encoder.go" | |
| if [ ! -f "$TARGET" ]; then | |
| echo "Target file not found: $TARGET" >&2 | |
| exit 1 | |
| fi | |
| echo "Before change:" && grep -E 'DataShardsCount|ParityShardsCount' "$TARGET" || true | |
| sed -i 's/\(DataShardsCount[[:space:]]*=[[:space:]]*\)10/\19/' "$TARGET" | |
| sed -i 's/\(ParityShardsCount[[:space:]]*=[[:space:]]*\)4/\13/' "$TARGET" | |
| echo "After change:" && grep -E 'DataShardsCount|ParityShardsCount' "$TARGET" || true | |
| - name: Docker meta | |
| id: docker_meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| chrislusf/seaweedfs-enterprise | |
| tags: | | |
| type=ref,event=tag,suffix=_large_disk_rocksdb_9_3 | |
| type=raw,value=latest,suffix=_large_disk_rocksdb_9_3,enable={{is_default_branch}} | |
| flavor: | | |
| latest=false | |
| labels: | | |
| org.opencontainers.image.title=seaweedfs-enterprise | |
| org.opencontainers.image.description=SeaweedFS Enterprise (RocksDB) with 9 data + 3 parity shards for erasure coding | |
| org.opencontainers.image.vendor=Chris Lu | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| # Login to GitHub Container Registry (for pulling base images) | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| # Login to Docker Hub BEFORE building to avoid rate limits | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Create custom Dockerfile for modified source | |
| run: | | |
| # Copy the original Dockerfile and modify it to use our modified source | |
| cp seaweedfs-enterprise-source/docker/Dockerfile.rocksdb_large seaweedfs-enterprise-source/docker/Dockerfile.rocksdb_9_3 | |
| # Replace the git clone step with copying our modified source | |
| sed -i '/RUN git clone.*seaweedfs/d' seaweedfs-enterprise-source/docker/Dockerfile.rocksdb_9_3 | |
| sed -i '/ARG BRANCH=/d' seaweedfs-enterprise-source/docker/Dockerfile.rocksdb_9_3 | |
| sed -i '/RUN cd.*git checkout/d' seaweedfs-enterprise-source/docker/Dockerfile.rocksdb_9_3 | |
| sed -i '/RUN mkdir -p \/go\/src\/github.com\/seaweedfs\//a COPY . /go/src/github.com/seaweedfs/seaweedfs' seaweedfs-enterprise-source/docker/Dockerfile.rocksdb_9_3 | |
| - name: Build and push Docker image (RocksDB 9/3) | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./seaweedfs-enterprise-source | |
| push: ${{ github.event_name != 'pull_request' }} | |
| file: ./seaweedfs-enterprise-source/docker/Dockerfile.rocksdb_9_3 | |
| platforms: linux/amd64 | |
| tags: ${{ steps.docker_meta.outputs.tags }} | |
| labels: ${{ steps.docker_meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |