From 1ea8c3c8662f0b83fe20627e8b4a40caf1b17da8 Mon Sep 17 00:00:00 2001 From: samanhappy Date: Mon, 14 Apr 2025 17:09:21 +0800 Subject: [PATCH] fix: update Dockerfile to conditionally install Playwright dependencies based on INSTALL_EXT argument --- .github/workflows/build.yml | 11 ++++++++--- Dockerfile | 6 +++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 30e1a66..3078fdc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,6 +8,9 @@ on: jobs: build: runs-on: ubuntu-latest + strategy: + matrix: + variant: [base, full] steps: - uses: actions/checkout@v4 with: @@ -28,9 +31,9 @@ jobs: with: images: samanhappy/mcphub tags: | - type=raw,value=edge,enable=${{ github.ref == 'refs/heads/main' }} - type=semver,pattern={{version}},enable=${{ startsWith(github.ref, 'refs/tags/') }} - type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }} + type=raw,value=edge${{ matrix.variant == 'full' && '-full' || '' }},enable=${{ github.ref == 'refs/heads/main' }} + type=semver,pattern={{version}}${{ matrix.variant == 'full' && '-full' || '' }},enable=${{ startsWith(github.ref, 'refs/tags/') }} + type=raw,value=latest${{ matrix.variant == 'full' && '-full' || '' }},enable=${{ startsWith(github.ref, 'refs/tags/') }} - name: Build and Push Docker Image uses: docker/build-push-action@v5 @@ -42,3 +45,5 @@ jobs: cache-from: type=gha cache-to: type=gha,mode=max platforms: linux/amd64,linux/arm64 + build-args: | + INSTALL_EXT=${{ matrix.variant == 'full' && 'true' || 'false' }} diff --git a/Dockerfile b/Dockerfile index 43419f8..20f8447 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,11 @@ ENV PNPM_HOME=/usr/local/share/pnpm ENV PATH=$PNPM_HOME:$PATH RUN mkdir -p $PNPM_HOME && \ pnpm add -g @amap/amap-maps-mcp-server @playwright/mcp@latest tavily-mcp@latest @modelcontextprotocol/server-github @modelcontextprotocol/server-slack -RUN npx -y playwright install-deps && npx -y playwright install chrome + +ARG INSTALL_EXT=false +RUN if [ "$INSTALL_EXT" = "true" ]; then \ + npx -y playwright install-deps && npx -y playwright install firefox; \ + fi RUN uv tool install mcp-server-fetch ENV UV_PYTHON_INSTALL_MIRROR="http://mirrors.aliyun.com/pypi/simple/"