-
Notifications
You must be signed in to change notification settings - Fork 40
feat(docker): add support for a docker build image of datahub-mcp-server #92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 9 commits
cfbe4bc
6910393
5b19d28
0c74fc4
aca8f82
d2483a1
f1e206a
9baad66
ce63cc2
1b17321
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| name: Docker | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
|
|
||
| jobs: | ||
| build_and_publish: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Extract version from release tag | ||
| id: version | ||
| run: | | ||
| echo "version=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Log in to Docker Hub | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| username: ${{ secrets.DOCKER_USERNAME }} | ||
| password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
|
||
| - name: Log in to GitHub Container Registry | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Build and push | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
| push: true | ||
| build-args: | | ||
| VERSION=${{ steps.version.outputs.version }} | ||
| tags: | | ||
| acryldata/mcp-server-datahub:${{ steps.version.outputs.version }} | ||
| acryldata/mcp-server-datahub:latest | ||
| ghcr.io/${{ github.repository }}:${{ steps.version.outputs.version }} | ||
| ghcr.io/${{ github.repository }}:latest | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| FROM python:3.11-slim | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| # Install uv | ||
| COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv | ||
|
|
||
| # Copy dependency files | ||
| COPY pyproject.toml uv.lock ./ | ||
|
|
||
| # Install dependencies (no dev deps, no editable install yet) | ||
| RUN uv sync --frozen --no-dev --no-install-project | ||
|
|
||
| # Copy source | ||
| COPY src/ ./src/ | ||
|
|
||
| # Inject version at build time so setuptools-scm fallback (0.0.0) is not used. | ||
| # The .git directory is not available during Docker builds, so we write | ||
| # _version.py directly from the VERSION build arg. | ||
| ARG VERSION=0.0.0 | ||
| RUN printf '__version__ = version = "%s"\n__version_tuple__ = version_tuple = tuple(int(x) if x.isdigit() else x for x in "%s".lstrip("v").split("."))\n__commit_id__ = commit_id = None\n' \ | ||
| "$VERSION" "$VERSION" \ | ||
| > src/mcp_server_datahub/_version.py | ||
|
|
||
| # Install the project itself | ||
| RUN uv sync --frozen --no-dev | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Docker image always reports version 0.0.0Medium Severity The project uses
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed this |
||
|
|
||
| ENV PATH="/app/.venv/bin:$PATH" | ||
|
|
||
| EXPOSE 8000 | ||
|
|
||
| CMD ["mcp-server-datahub", "--transport", "http"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| services: | ||
| mcp-server-datahub: | ||
| build: . | ||
| ports: | ||
| - "${MCP_SERVER_PORT:-8000}:8000" | ||
| environment: | ||
| DATAHUB_GMS_URL: ${DATAHUB_GMS_URL} | ||
| TOOLS_IS_MUTATION_ENABLED: ${TOOLS_IS_MUTATION_ENABLED:-false} | ||
| TOOLS_IS_USER_ENABLED: ${TOOLS_IS_USER_ENABLED:-false} |


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unpinned
uv:latesttag risks breaking Docker buildsMedium Severity
The
COPY --from=ghcr.io/astral-sh/uv:latestuses an unpinned:latesttag, making the Docker build non-reproducible. Ifuvreleases a breaking change (e.g., moving the binary path from/uv, or changing CLI behavior), builds will silently break. The existingwheels.ymlworkflow pinsastral-sh/setup-uv@v6, but this Dockerfile has no version constraint at all. Pinning to a specific version or major version tag (e.g.,uv:0.6) would prevent unexpected build failures.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ignoring this as other use cases use uv:latest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not pin? where are the other use cases that use uv:latest?