diff --git a/.github/workflows/publish_latest_pd_store_server_image.yml b/.github/workflows/publish_latest_pd_store_server_image.yml new file mode 100644 index 0000000..459d6e5 --- /dev/null +++ b/.github/workflows/publish_latest_pd_store_server_image.yml @@ -0,0 +1,120 @@ +name: "Publish pd-store-server image(latest)" + +on: + workflow_dispatch: + inputs: + mvn_args: + required: false + default: 'MAVEN_ARGS=-P stage' + description: 'mvn build args, like "MAVEN_ARGS=-P stage"' + +jobs: + build_latest: + runs-on: ubuntu-latest + env: + REPOSITORY_URL: apache/hugegraph + BRANCH: master + PD_IMAGE_URL: hugegraph/pd:latest + STORE_IMAGE_URL: hugegraph/store:latest + SERVER_IMAGE_URL: hugegraph/server:latest + MVN_ARGS: ${{inputs.mvn_args}} + + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + + - name: Checkout latest + uses: actions/checkout@v4 + with: + repository: ${{ env.REPOSITORY_URL }} + ref: ${{ env.BRANCH }} + fetch-depth: 2 + + - name: Build x86 PD Image + uses: docker/build-push-action@v5 + with: + context: . + file: ./hugegraph-pd/Dockerfile + load: true + tags: ${{ env.PD_IMAGE_URL }} + cache-from: type=gha + cache-to: type=gha,mode=max + build-args: ${{ env.MVN_ARGS }} + + - name: Build x86 Store Image + uses: docker/build-push-action@v5 + with: + context: . + file: ./hugegraph-store/Dockerfile + load: true + tags: ${{ env.STORE_IMAGE_URL }} + cache-from: type=gha + cache-to: type=gha,mode=max + build-args: ${{ env.MVN_ARGS }} + + - name: Build x86 Server Image + uses: docker/build-push-action@v5 + with: + context: . + file: ./hugegraph-server/Dockerfile + load: true + tags: ${{ env.SERVER_IMAGE_URL }} + cache-from: type=gha + cache-to: type=gha,mode=max + build-args: ${{ env.MVN_ARGS }} + + - name: Test x86 Images + run: | + docker images + docker run -itd --name=pd --network host $PD_IMAGE_URL + sleep 10s + curl 0.0.0.0:8620 || exit + docker run -itd --name=store --network host $STORE_IMAGE_URL + sleep 10s + curl 0.0.0.0:8520 || exit + docker run -itd --name=server --network host $SERVER_IMAGE_URL + sleep 10s + curl 0.0.0.0:8080 || exit + docker ps -a + + - name: Push x86 & ARM PD Images + uses: docker/build-push-action@v5 + with: + context: . + file: ./hugegraph-pd/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ env.PD_IMAGE_URL }} + cache-from: type=gha + cache-to: type=gha,mode=max + build-args: ${{ env.MVN_ARGS }} + + - name: Push x86 & ARM Store Images + uses: docker/build-push-action@v5 + with: + context: . + file: ./hugegraph-store/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ env.STORE_IMAGE_URL }} + cache-from: type=gha + cache-to: type=gha,mode=max + build-args: ${{ env.MVN_ARGS }} + + - name: Push x86 & ARM Server Images + uses: docker/build-push-action@v5 + with: + context: . + file: ./hugegraph-server/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ env.SERVER_IMAGE_URL }} + cache-from: type=gha + cache-to: type=gha,mode=max + build-args: ${{ env.MVN_ARGS }}