From f3b5cfbaaeb51e3756ba4655bb37a07ad3cad896 Mon Sep 17 00:00:00 2001 From: FRFlo <62435410+FRFlo@users.noreply.github.com> Date: Mon, 14 Sep 2026 00:17:29 +0200 Subject: [PATCH 1/2] ci: build and publish Docker image to GHCR --- .github/workflows/docker.yml | 53 ++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..0d7fb08 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,53 @@ +name: Build and publish Docker image + +on: + push: + branches: [main] + tags: ['v*.*.*'] + workflow_dispatch: + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + docker: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Log in to GHCR + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=raw,value=latest,enable={{is_default_branch}} + type=ref,event=branch + type=ref,event=tag + type=sha + + - name: Build and push image + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max From 98d207896cb35746a36b3ddc884effbde19425ee Mon Sep 17 00:00:00 2001 From: CabLate <85614048+cablate@users.noreply.github.com> Date: Wed, 16 Sep 2026 19:35:36 +0800 Subject: [PATCH 2/2] fix: harden GHCR image publishing --- .dockerignore | 17 +++++++++++++++++ .github/workflows/docker.yml | 8 ++++++++ .github/workflows/release.yml | 9 +++++++++ 3 files changed, 34 insertions(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..849910b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,17 @@ +.git +**/.git +.env +.env.* +**/.env +**/.env.* +.npmrc +**/.npmrc +credentials.json +**/credentials.json +node_modules +**/node_modules +dist +output +.agents +.mcpregistry_* +.mcp.json diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 0d7fb08..0f12233 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -10,6 +10,10 @@ env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} +concurrency: + group: docker-${{ github.ref }} + cancel-in-progress: true + jobs: docker: runs-on: ubuntu-latest @@ -20,6 +24,8 @@ jobs: steps: - name: Check out repository uses: actions/checkout@v4 + with: + persist-credentials: false - name: Log in to GHCR uses: docker/login-action@v3 @@ -36,6 +42,8 @@ jobs: uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + flavor: | + latest=false tags: | type=raw,value=latest,enable={{is_default_branch}} type=ref,event=branch diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e60b6d6..df5922a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,6 +16,7 @@ jobs: permissions: contents: write id-token: write + actions: write steps: - uses: actions/checkout@v4 with: @@ -119,3 +120,11 @@ jobs: gh release create "v${VERSION}" --title "v${VERSION}" --notes "$NOTES" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Publish release Docker images + run: | + VERSION=$(node -p "require('./package.json').version") + gh workflow run docker.yml --ref main + gh workflow run docker.yml --ref "v${VERSION}" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}