Skip to content

Commit 2c079bf

Browse files
committed
update dockerfile
1 parent 4361d61 commit 2c079bf

File tree

6 files changed

+85
-20
lines changed

6 files changed

+85
-20
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,21 @@ jobs:
128128
- name: Build and push container image
129129
run: |
130130
# Build the image
131-
podman build -t "ghcr.io/${{ github.repository }}/vtk-mcp:latest" \
132-
-t "ghcr.io/${{ github.repository }}/vtk-mcp:${{ github.sha }}" \
133-
-t "ghcr.io/${{ github.repository }}/vtk-mcp:${{ steps.slug.outputs.SHORT_SHA }}" \
131+
GITHUB_REPOSITORY="$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')"
132+
podman build -t "ghcr.io/${GITHUB_REPOSITORY}/vtk-mcp:latest" \
133+
-t "ghcr.io/${GITHUB_REPOSITORY}/vtk-mcp:${{ github.sha }}" \
134+
-t "ghcr.io/${GITHUB_REPOSITORY}/vtk-mcp:${{ steps.slug.outputs.SHORT_SHA }}" \
134135
.
135136

136137
# Push all tags
137-
podman push "ghcr.io/${{ github.repository }}/vtk-mcp:latest"
138-
podman push "ghcr.io/${{ github.repository }}/vtk-mcp:${{ github.sha }}"
139-
podman push "ghcr.io/${{ github.repository }}/vtk-mcp:${{ steps.slug.outputs.SHORT_SHA }}"
138+
podman push "ghcr.io/${GITHUB_REPOSITORY}/vtk-mcp:latest"
139+
podman push "ghcr.io/${GITHUB_REPOSITORY}/vtk-mcp:${{ github.sha }}"
140+
podman push "ghcr.io/${GITHUB_REPOSITORY}/vtk-mcp:${{ steps.slug.outputs.SHORT_SHA }}"
141+
142+
# Make sure that it is public
143+
curl -X PATCH \
144+
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
145+
-H "Accept: application/vnd.github.v3+json" \
146+
-d '{"visibility": "public"}' \
147+
https://api.github.com/repos/Kitware/vtk-mcp/packages/container/vtk-mcp
148+

Dockerfile

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,28 @@
11
LABEL org.opencontainers.image.title="VTK MCP Server"
22
LABEL org.opencontainers.image.description="Model Context Protocol server for VTK class documentation"
33
LABEL org.opencontainers.image.source="https://github.com/kitware/vtk-mcp"
4+
LABEL org.opencontainers.image.authors="Vicente Adolfo Bolea Sanchez <[email protected]>"
45
LABEL org.opencontainers.image.licenses="MIT"
56
LABEL org.opencontainers.image.documentation="https://github.com/kitware/vtk-mcp/blob/main/README.md"
67

78
FROM python:3.12-slim
89

9-
WORKDIR /app
10-
1110
ENV PIP_DISABLE_PIP_VERSION_CHECK=1 \
1211
PIP_NO_CACHE_DIR=1 \
1312
PYTHONDONTWRITEBYTECODE=1 \
1413
PYTHONUNBUFFERED=1
1514

1615
# Install system dependencies for VTK
17-
RUN apt update && apt install -y \
18-
libgl1-mesa-glx \
19-
libglib2.0-0 \
20-
libgomp1 \
21-
libsm6 \
22-
libxext6 \
23-
libxrender-dev
16+
RUN apt update && \
17+
apt install --no-install-recommends --no-install-suggests -y \
18+
libgl1-mesa-dev \
19+
libxrender-dev/stable
2420

21+
WORKDIR /app
2522
COPY . .
2623
RUN pip install --upgrade pip && \
2724
pip install --verbose .
2825

29-
# Create non-root user for security
30-
#RUN useradd --create-home --shell /bin/bash --uid 1000 vtk-user && \
31-
# chown -R vtk-user:vtk-user /app
32-
#USER vtk-user
33-
3426
EXPOSE 8000
3527

3628
CMD ["vtk-mcp-server", "--transport", "http", "--host", "0.0.0.0", "--port", "8000"]

deploy/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# How to deploy

deploy/vtk-mcp-server-compose.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: '3.3'
2+
3+
services:
4+
vtk-mcp:
5+
image: ghcr.io/kitware/vtk-mcp/vtk-mcp:latest
6+
network_mode: host
7+
restart: unless-stopped
8+
9+
watchtower:
10+
image: containrrr/watchtower
11+
volumes:
12+
- /var/run/docker.sock:/var/run/docker.sock
13+
environment:
14+
- WATCHTOWER_POLL_INTERVAL=300 # Check every 5 minutes
15+
- WATCHTOWER_CLEANUP=true # Remove old images
16+
- WATCHTOWER_INCLUDE_RESTARTING=true
17+

deploy/vtk-mcp-server-deploy.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
- name: Deploy vtk-server
3+
become: yes
4+
hosts: all
5+
tasks:
6+
- ansible.builtin.package:
7+
name:
8+
- docker.io
9+
- docker-compose-v2
10+
state: latest
11+
12+
- name: Create a directory if it does not exist
13+
ansible.builtin.file:
14+
path: /var/opt/vtk-mcp-server-compose
15+
state: directory
16+
17+
- name: install vtk-mcp-server-compose files
18+
ansible.builtin.copy:
19+
src: "{{ item[0]}}"
20+
dest: "{{ item[1] }}"
21+
loop:
22+
- ['./vtk-mcp-server-compose.yml', '/var/opt/vtk-mcp-server/']
23+
- ['./vtk-mcp-server.service', '/etc/systemd/system/']
24+
25+
- name: restart vtk-mcp-server services
26+
ansible.builtin.systemd:
27+
daemon-reload: true
28+
name: vtk-mcp-server.service
29+
enabled: true
30+
state: restarted

deploy/vtk-mcp-server.service

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[Unit]
2+
Description=Docker Compose for vtk-mcp-server-compose.yml
3+
Requires=docker.service
4+
After=docker.service
5+
6+
[Service]
7+
Type=oneshot
8+
RemainAfterExit=yes
9+
WorkingDirectory=/var/opt/vtk-mcp-server
10+
ExecStartPre=/usr/bin/docker-compose -f ./vtk-mcp-server-compose.yml pull --ignore-pull-failures
11+
ExecStart=/usr/bin/docker-compose -f ./vtk-mcp-server-compose.yml up -d --build
12+
ExecStop=/usr/bin/docker-compose -f ./vtk-mcp-server-compose.yml down
13+
TimeoutStartSec=0
14+
15+
[Install]
16+
WantedBy=multi-user.target

0 commit comments

Comments
 (0)