Skip to content

Commit ce3b20a

Browse files
committed
Add dockerfile
1 parent 3b990c7 commit ce3b20a

File tree

4 files changed

+136
-0
lines changed

4 files changed

+136
-0
lines changed

.dockerignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# VCS/IDE
2+
.git
3+
.gitignore
4+
.cursor
5+
.vscode
6+
.DS_Store
7+
8+
# CI and docs
9+
.github
10+
assets
11+
design
12+
13+
# Python artifacts
14+
__pycache__
15+
*.pyc
16+
*.pyo
17+
*.pyd
18+
*.log
19+
*.egg-info
20+
dist
21+
build
22+
.cache
23+
.venv
24+
venv
25+
env
26+
27+
# Desktop extension bundle
28+
*.dxt
29+
30+
# MCP registry metadata (if added later)
31+
.mcp
32+
33+
# Vendored libs (we install via pip inside the image)
34+
server/lib/
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Docker Publish
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
env:
9+
IMAGE_NAME: docker.io/zenmldocker/mcp-zenml
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
build-and-push:
16+
runs-on: ubuntu-latest
17+
concurrency:
18+
group: docker-publish-${{ github.ref }}
19+
cancel-in-progress: true
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Set up QEMU
25+
uses: docker/setup-qemu-action@v3
26+
27+
- name: Set up Docker Buildx
28+
uses: docker/setup-buildx-action@v3
29+
30+
- name: Log in to Docker Hub
31+
uses: docker/login-action@v3
32+
with:
33+
username: ${{ secrets.DOCKERHUB_USERNAME }}
34+
password: ${{ secrets.DOCKERHUB_TOKEN }}
35+
36+
- name: Extract metadata (tags, labels)
37+
id: meta
38+
uses: docker/metadata-action@v5
39+
with:
40+
images: ${{ env.IMAGE_NAME }}
41+
tags: |
42+
type=raw,value=latest,enable={{is_default_branch}}
43+
type=sha,format=short,prefix=sha-
44+
labels: |
45+
org.opencontainers.image.title=ZenML MCP Server
46+
org.opencontainers.image.description=Model Context Protocol server for ZenML
47+
org.opencontainers.image.source=https://github.com/${{ github.repository }}
48+
org.opencontainers.image.licenses=MIT
49+
50+
- name: Build and push
51+
uses: docker/build-push-action@v6
52+
with:
53+
context: .
54+
file: ./Dockerfile
55+
push: true
56+
platforms: linux/amd64,linux/arm64
57+
tags: ${{ steps.meta.outputs.tags }}
58+
labels: ${{ steps.meta.outputs.labels }}
59+
cache-from: type=gha
60+
cache-to: type=gha,mode=max
61+
62+
- name: Image digest
63+
run: echo "Digest -> ${{ steps.meta.outputs.digest }}"

Dockerfile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# syntax=docker/dockerfile:1
2+
FROM python:3.12-slim AS base
3+
4+
ENV PYTHONDONTWRITEBYTECODE=1 \
5+
PYTHONUNBUFFERED=1 \
6+
PYTHONIOENCODING=UTF-8 \
7+
PIP_NO_CACHE_DIR=1 \
8+
LOGLEVEL=WARNING \
9+
NO_COLOR=1 \
10+
ZENML_LOGGING_COLORS_DISABLED=true \
11+
ZENML_ENABLE_RICH_TRACEBACK=false
12+
13+
# Optional but helpful: fresh CA certs for TLS reliability
14+
RUN apt-get update \
15+
&& apt-get install -y --no-install-recommends ca-certificates \
16+
&& rm -rf /var/lib/apt/lists/*
17+
18+
WORKDIR /app
19+
20+
# Install Python dependencies
21+
COPY requirements.txt /app/
22+
RUN pip install --upgrade pip setuptools wheel \
23+
&& pip install -r requirements.txt
24+
25+
# Security: non-root user
26+
RUN useradd -m -u 10001 appuser
27+
USER appuser
28+
29+
# Copy only what we need to run the server in stdio mode
30+
COPY --chown=appuser:appuser server/zenml_server.py /app/server/zenml_server.py
31+
32+
# OCI labels (will be enriched/overridden by CI metadata)
33+
LABEL org.opencontainers.image.title="ZenML MCP Server" \
34+
org.opencontainers.image.description="Model Context Protocol server for ZenML" \
35+
org.opencontainers.image.source="https://github.com/zenml-io/mcp-zenml" \
36+
org.opencontainers.image.licenses="MIT"
37+
38+
ENTRYPOINT ["python", "-u", "server/zenml_server.py"]

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ httpx
22
mcp[cli]
33
zenml
44
setuptools
5+
requests>=2.32.0

0 commit comments

Comments
 (0)