9494 password : ${{ secrets.GITHUB_TOKEN }}
9595
9696 - name : Login to Docker Hub
97+ id : dockerhub_login
9798 if : github.event_name == 'push'
99+ continue-on-error : true
98100 uses : docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4.0.0
99101 with :
100102 username : ${{ secrets.DOCKERHUB_USERNAME }}
@@ -111,17 +113,30 @@ jobs:
111113 tags : ${{ env.IMAGE_NAME }}:pr-${{ github.event.number }}
112114 cache-from : type=gha
113115
114- # Push to main: build multi-platform and push with rolling tags
115- - name : Build and push Docker image
116+ # Push to main: build multi-platform and push the production GHCR tag.
117+ - name : Build and push Docker image (GHCR)
116118 if : github.event_name == 'push'
117119 uses : docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
118120 with :
119121 push : true
120122 platforms : linux/amd64,linux/arm64
121123 file : ./Dockerfile
122- tags : |
123- ${{ env.IMAGE_NAME }}:main
124- ${{ env.DOCKERHUB_IMAGE }}:mcp-dev
124+ tags : ${{ env.IMAGE_NAME }}:main
125+ labels : |
126+ io.modelcontextprotocol.server.name=io.github.CodeAlive-AI/codealive-mcp
127+ cache-from : type=gha
128+ cache-to : type=gha
129+
130+ # Docker Hub is a secondary self-hosted distribution channel. Missing
131+ # credentials must not block GHCR, because production pulls from GHCR.
132+ - name : Build and push Docker image (Docker Hub)
133+ if : github.event_name == 'push' && steps.dockerhub_login.outcome == 'success'
134+ uses : docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
135+ with :
136+ push : true
137+ platforms : linux/amd64,linux/arm64
138+ file : ./Dockerfile
139+ tags : ${{ env.DOCKERHUB_IMAGE }}:mcp-dev
125140 labels : |
126141 io.modelcontextprotocol.server.name=io.github.CodeAlive-AI/codealive-mcp
127142 cache-from : type=gha
0 commit comments