diff --git a/.github/workflows/image.yml b/.github/workflows/image.yml index 3d9951e..8d35e17 100644 --- a/.github/workflows/image.yml +++ b/.github/workflows/image.yml @@ -19,6 +19,12 @@ jobs: - name: Checkout source uses: actions/checkout@v3 + - 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 the Container registry uses: docker/login-action@v3 with: @@ -26,16 +32,20 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Setup .NET SDK - uses: actions/setup-dotnet@v4 + - name: Build and push mcp-gateway multi-arch image + uses: docker/build-push-action@v5 with: - dotnet-version: '8.x' - - - name: Restore dependencies - run: dotnet restore dotnet/Microsoft.McpGateway.sln --runtime linux-x64 - - - name: Publish and push the mcp-gateway container image - run: dotnet publish dotnet/Microsoft.McpGateway.Service/src/Microsoft.McpGateway.Service.csproj --configuration Release --no-restore /p:PublishProfile=github.pubxml /p:ContainerRepository=${{ github.repository_owner }}/mcp-gateway - - - name: Publish and push the tool-gateway container image - run: dotnet publish dotnet/Microsoft.McpGateway.Tools/src/Microsoft.McpGateway.Tools.csproj --configuration Release --no-restore /p:PublishProfile=github.pubxml /p:ContainerRepository=${{ github.repository_owner }}/tool-gateway + context: . + file: ./dotnet/Microsoft.McpGateway.Service/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: ghcr.io/${{ github.repository_owner }}/mcp-gateway:latest + + - name: Build and push tool-gateway multi-arch image + uses: docker/build-push-action@v5 + with: + context: . + file: ./dotnet/Microsoft.McpGateway.Tools/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: ghcr.io/${{ github.repository_owner }}/tool-gateway:latest diff --git a/dotnet/Microsoft.McpGateway.Service/Dockerfile b/dotnet/Microsoft.McpGateway.Service/Dockerfile new file mode 100644 index 0000000..c37fe30 --- /dev/null +++ b/dotnet/Microsoft.McpGateway.Service/Dockerfile @@ -0,0 +1,33 @@ +# Build stage +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +WORKDIR /src + +# Copy solution and project files +COPY dotnet/Directory.Packages.props dotnet/ +COPY dotnet/Microsoft.McpGateway.sln dotnet/ +COPY dotnet/Microsoft.McpGateway.Management/src/Microsoft.McpGateway.Management.csproj dotnet/Microsoft.McpGateway.Management/src/ +COPY dotnet/Microsoft.McpGateway.Service/src/Microsoft.McpGateway.Service.csproj dotnet/Microsoft.McpGateway.Service/src/ + +# Restore dependencies +RUN dotnet restore dotnet/Microsoft.McpGateway.Service/src/Microsoft.McpGateway.Service.csproj + +# Copy the rest of the source code +COPY dotnet/Microsoft.McpGateway.Management/src dotnet/Microsoft.McpGateway.Management/src/ +COPY dotnet/Microsoft.McpGateway.Service/src dotnet/Microsoft.McpGateway.Service/src/ + +# Build and publish the application +WORKDIR /src/dotnet/Microsoft.McpGateway.Service/src +RUN dotnet publish Microsoft.McpGateway.Service.csproj -c Release -o /app/publish --no-restore + +# Runtime stage +FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime +WORKDIR /app + +# Copy published application from build stage +COPY --from=build /app/publish . + +# Expose port +EXPOSE 8000 + +# Set entrypoint +ENTRYPOINT ["dotnet", "Microsoft.McpGateway.Service.dll"] diff --git a/dotnet/Microsoft.McpGateway.Tools/Dockerfile b/dotnet/Microsoft.McpGateway.Tools/Dockerfile new file mode 100644 index 0000000..b6b2bd4 --- /dev/null +++ b/dotnet/Microsoft.McpGateway.Tools/Dockerfile @@ -0,0 +1,33 @@ +# Build stage +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +WORKDIR /src + +# Copy solution and project files +COPY dotnet/Directory.Packages.props dotnet/ +COPY dotnet/Microsoft.McpGateway.sln dotnet/ +COPY dotnet/Microsoft.McpGateway.Management/src/Microsoft.McpGateway.Management.csproj dotnet/Microsoft.McpGateway.Management/src/ +COPY dotnet/Microsoft.McpGateway.Tools/src/Microsoft.McpGateway.Tools.csproj dotnet/Microsoft.McpGateway.Tools/src/ + +# Restore dependencies +RUN dotnet restore dotnet/Microsoft.McpGateway.Tools/src/Microsoft.McpGateway.Tools.csproj + +# Copy the rest of the source code +COPY dotnet/Microsoft.McpGateway.Management/src dotnet/Microsoft.McpGateway.Management/src/ +COPY dotnet/Microsoft.McpGateway.Tools/src dotnet/Microsoft.McpGateway.Tools/src/ + +# Build and publish the application +WORKDIR /src/dotnet/Microsoft.McpGateway.Tools/src +RUN dotnet publish Microsoft.McpGateway.Tools.csproj -c Release -o /app/publish --no-restore + +# Runtime stage +FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime +WORKDIR /app + +# Copy published application from build stage +COPY --from=build /app/publish . + +# Expose port +EXPOSE 8000 + +# Set entrypoint +ENTRYPOINT ["dotnet", "Microsoft.McpGateway.Tools.dll"]