fix(cli): exit the server when the MCP client closes stdin #77
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Docker Image (Build, Test & Push) | |
| on: | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - "Dockerfile" | |
| - ".dockerignore" | |
| - "src/**" | |
| - "package.json" | |
| - "yarn.lock" | |
| - "tests/docker/**" | |
| - ".github/workflows/docker.yml" | |
| push: | |
| branches: [main] | |
| tags: | |
| - "v[0-9]+.[0-9]+.[0-9]+" | |
| env: | |
| IMAGE_NAME: localstack/localstack-mcp-server | |
| jobs: | |
| smoke: | |
| runs-on: ubuntu-latest | |
| env: | |
| CI_LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build image (single-arch, load locally) | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| load: true | |
| tags: ${{ env.IMAGE_NAME }}:ci | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Use Node.js 22 | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22.x | |
| - name: Smoke test MCP startup | |
| env: | |
| HARNESS_SKIP: prompt,docs,status,start,aws,logs,state,cloudpods,appinspector,chaos,iam,replicator,ephemeral,deploy,deploy-cdk,extensions,restart,stop,snowflake | |
| run: | | |
| node tests/docker/validate-image.mjs -- \ | |
| docker run -i --rm \ | |
| ${{ env.IMAGE_NAME }}:ci | |
| - name: Integration test Docker runtime | |
| if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository | |
| env: | |
| LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }} | |
| HARNESS_TOKEN_REAL: ${{ secrets.LOCALSTACK_AUTH_TOKEN != '' && '1' || '0' }} | |
| HARNESS_SKIP: cloudpods,ephemeral,replicator,chaos | |
| run: | | |
| npm ci --prefix data/sample-cdk | |
| node tests/docker/validate-image.mjs -- \ | |
| docker run -i --rm \ | |
| -v /var/run/docker.sock:/var/run/docker.sock \ | |
| --add-host host.docker.internal:host-gateway \ | |
| --add-host s3.host.docker.internal:host-gateway \ | |
| --add-host snowflake.localhost.localstack.cloud:host-gateway \ | |
| -e LOCALSTACK_AUTH_TOKEN \ | |
| -e LOCALSTACK_HOSTNAME=host.docker.internal \ | |
| -v "$PWD/data:/work/data" \ | |
| ${{ env.IMAGE_NAME }}:ci | |
| push: | |
| name: Build & Push (multi-arch) | |
| needs: smoke | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref_type == 'tag') | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: docker-push | |
| deployment: false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_PUSH_TOKEN }} | |
| - name: Derive image tags | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| type=sha,enable={{is_default_branch}} | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| flavor: | | |
| latest=false | |
| - name: Build and push (linux/amd64, linux/arm64) | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| provenance: false | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: Sync README to Docker Hub overview | |
| if: github.ref == 'refs/heads/main' | |
| continue-on-error: true | |
| uses: peter-evans/dockerhub-description@v4 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_PUSH_TOKEN }} | |
| repository: ${{ env.IMAGE_NAME }} | |
| readme-filepath: ./README.md |