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 new file mode 100644 index 0000000..0f12233 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,61 @@ +name: Build and publish Docker image + +on: + push: + branches: [main] + tags: ['v*.*.*'] + workflow_dispatch: + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +concurrency: + group: docker-${{ github.ref }} + cancel-in-progress: true + +jobs: + docker: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Check out repository + uses: actions/checkout@v4 + with: + persist-credentials: false + + - 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 }} + flavor: | + latest=false + 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 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 }}