-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathDockerfile
More file actions
60 lines (50 loc) · 1.92 KB
/
Dockerfile
File metadata and controls
60 lines (50 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Choose a specific Python base image (slim versions are smaller)
FROM python:3.10-slim
LABEL maintainer="Your Name <you@example.com>"
LABEL description="Docker image for pyATS MCP Server interacting via stdio"
# Install system dependencies required by pyATS, SSH, and your script
# Combine update, install, and cleanup in one layer to optimize image size
RUN echo "==> Installing System Dependencies..." \
&& apt-get update \
&& apt-get install --no-install-recommends -y \
openssh-client \
dos2unix \
build-essential \
libssl-dev \
libffi-dev \
libxml2-dev \
libxslt1-dev \
zlib1g-dev \
git \
# Clean up apt cache to reduce image size
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory inside the container
WORKDIR /app
# Upgrade pip and install Python dependencies
# Breaking down the installation process to handle problematic packages first
RUN echo "==> Upgrading pip and installing build tools..." \
&& pip install --no-cache-dir --upgrade pip setuptools wheel
# Install the problematic packages first
RUN echo "==> Installing problematic dependencies separately..." \
&& pip install --no-cache-dir \
backports.ssl \
backports.ssl-match-hostname \
tftpy \
ncclient \
f5-icontrol-rest
# Then install the main packages
RUN echo "==> Installing pyATS and other Python packages..." \
&& pip install --no-cache-dir \
pydantic \
python-dotenv \
fastmcp \
pyats[full]==25.2.0
# Copy your application code into the container's working directory
COPY pyats_mcp_server.py .
# Optional: If you have other files needed by the script (e.g., commands.json), copy them too
# COPY commands.json .
# Define the entrypoint to run your server script
ENTRYPOINT ["python", "pyats_mcp_server.py"]
# For the default continuous mode, no CMD arguments are needed
CMD []