From 7ec7a11da61af818b58ca395d252ab7395521ac0 Mon Sep 17 00:00:00 2001 From: Flouse <1297478+Flouse@users.noreply.github.com> Date: Thu, 12 Jun 2025 21:51:18 +0800 Subject: [PATCH 1/3] Add workflow to build and push Docker images to ghcr This workflow builds and pushes Docker images to the GitHub Container Registry (ghcr.io). --- .github/workflows/docker_build_and_push.yml | 65 +++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/docker_build_and_push.yml diff --git a/.github/workflows/docker_build_and_push.yml b/.github/workflows/docker_build_and_push.yml new file mode 100644 index 0000000..acf4c06 --- /dev/null +++ b/.github/workflows/docker_build_and_push.yml @@ -0,0 +1,65 @@ +name: Build and Push Docker Image + +on: + push: + branches: + - main + workflow_dispatch: + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository_owner }}/rapid-gossip-sync-server + +jobs: + build-and-push-docker: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + flavor: | + latest=true + tags: | + type=raw,value=latest + type=sha,format=long + labels: | + org.opencontainers.image.source=https://github.com/${{ github.repository }} + org.opencontainers.image.title=${{ env.IMAGE_NAME }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push Docker image + id: build + uses: docker/build-push-action@v6 + with: + context: . + file: docker/Dockerfile.rgs + cache-from: type=gha + cache-to: type=gha,mode=max + load: true + push: ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + - name: Print image metadata + run: | + echo "Image ID: ${{ steps.build.outputs.imageid }}" + echo "Digest: ${{ steps.build.outputs.digest }}" + echo "Metadata: ${{ steps.build.outputs.metadata }}" From 1bcd1d633712ca91460fa3cf3b6f4eaf3609557b Mon Sep 17 00:00:00 2001 From: Flouse <1297478+Flouse@users.noreply.github.com> Date: Thu, 12 Jun 2025 22:23:40 +0800 Subject: [PATCH 2/3] fix(CI): package `lock_api v0.4.13` requires rustc 1.64.0 or newer --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e3ad979..7879d25 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: matrix: toolchain: - stable - - 1.63.0 + - 1.64.0 - beta runs-on: ubuntu-latest steps: From ab81a1edbc25315341b94afbc61cd33d8ce12aa4 Mon Sep 17 00:00:00 2001 From: Flouse <1297478+Flouse@users.noreply.github.com> Date: Thu, 12 Jun 2025 22:43:53 +0800 Subject: [PATCH 3/3] fix(CI): package `tokio-macros v2.5.0` requires rustc 1.70 or newer --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7879d25..81db801 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: matrix: toolchain: - stable - - 1.64.0 + - 1.70.0 - beta runs-on: ubuntu-latest steps: