build-mcp-images #14
This file contains 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: Build MCP Images | |
on: | |
repository_dispatch: | |
types: [build-mcp-images] | |
jobs: | |
build-mcp-images: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
repository: modelcontextprotocol/servers | |
ref: ${{ github.event.client_payload.ref }} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERPUBLICBOT_USERNAME }} | |
password: ${{ secrets.DOCKERPUBLICBOT_WRITE_PAT }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
driver: cloud | |
endpoint: "mcp/cloud-ai-labs" | |
install: true | |
- name: Build MCP Images | |
run: | | |
top_level_folder=$(pwd) | |
for folder in src/*; do | |
# If folder does not contain Dockerfile, skip | |
if [ ! -f "$folder/Dockerfile" ]; then | |
continue | |
fi | |
# If folder has pyproject.toml | |
if [ -f "$folder/pyproject.toml" ]; then | |
cd $folder | |
docker buildx build --platform linux/amd64,linux/arm64 \ | |
--tag ${{ secrets.DOCKER_NS }}/mcp-$foldername:${{ github.event.client_payload.ref }} \ | |
--tag ${{ secrets.DOCKER_NS }}/mcp-$foldername:latest \ | |
--push . | |
cd $top_level_folder | |
else | |
foldername=$(basename $folder) | |
docker buildx build --platform linux/amd64,linux/arm64 \ | |
--tag ${{ secrets.DOCKER_NS }}/mcp-$foldername:${{ github.event.client_payload.ref }} \ | |
--tag ${{ secrets.DOCKER_NS }}/mcp-$foldername:latest \ | |
--file $folder/Dockerfile \ | |
--push . | |
fi | |
done |