Skip to content

Commit

Permalink
feat: support pd-store-server image publishment (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
VGalaxies authored Jul 16, 2024
1 parent 95e2b49 commit a2c1a57
Showing 1 changed file with 120 additions and 0 deletions.
120 changes: 120 additions & 0 deletions .github/workflows/publish_latest_pd_store_server_image.yml
Original file line number Diff line number Diff line change
@@ -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 }}

0 comments on commit a2c1a57

Please sign in to comment.