Skip to content

Commit 39f3663

Browse files
committed
feat: add Docker workflow for building and publishing images
1 parent bc65414 commit 39f3663

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

.github/workflows/docker.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: docker
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
env:
10+
REGISTRY: docker.io
11+
IMAGE_NAME: github-mcp-http
12+
DOCKERHUB_NAMESPACE: nickytonline
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v3
23+
24+
- name: Build image for validation
25+
uses: docker/build-push-action@v5
26+
with:
27+
context: .
28+
file: Dockerfile
29+
push: false
30+
tags: ${{ env.IMAGE_NAME }}:ci-${{ github.sha }}
31+
cache-from: type=gha
32+
cache-to: type=gha,mode=max
33+
34+
publish:
35+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
36+
needs: build
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Checkout repository
40+
uses: actions/checkout@v4
41+
42+
- name: Set up Docker Buildx
43+
uses: docker/setup-buildx-action@v3
44+
45+
- name: Validate Docker Hub secrets
46+
run: |
47+
set -euo pipefail
48+
: "${DOCKERHUB_USERNAME:?Missing Docker credentials}"
49+
: "${DOCKERHUB_TOKEN:?Missing Docker credentials}"
50+
env:
51+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
52+
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
53+
54+
- name: Log in to Docker Hub
55+
uses: docker/login-action@v3
56+
with:
57+
registry: ${{ env.REGISTRY }}
58+
username: ${{ secrets.DOCKERHUB_USERNAME }}
59+
password: ${{ secrets.DOCKERHUB_TOKEN }}
60+
61+
- name: Build and push image
62+
uses: docker/build-push-action@v5
63+
with:
64+
context: .
65+
file: Dockerfile
66+
push: true
67+
tags: |
68+
${{ env.REGISTRY }}/${{ env.DOCKERHUB_NAMESPACE }}/${{ env.IMAGE_NAME }}:latest
69+
${{ env.REGISTRY }}/${{ env.DOCKERHUB_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
70+
cache-from: type=gha
71+
cache-to: type=gha,mode=max
72+
73+
- name: Update Docker Hub description + short desc
74+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
75+
uses: peter-evans/dockerhub-description@v3
76+
with:
77+
username: ${{ secrets.DOCKERHUB_USERNAME }}
78+
password: ${{ secrets.DOCKERHUB_TOKEN }}
79+
repository: ${{ env.DOCKERHUB_NAMESPACE }}/${{ env.IMAGE_NAME }}
80+
readme-filepath: ./README.md
81+
short-description: GitHub MCP Server with HTTP streamable transport and OAuth support

0 commit comments

Comments
 (0)