-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (31 loc) · 863 Bytes
/
Dockerfile
File metadata and controls
45 lines (31 loc) · 863 Bytes
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
# Multi-stage build for Python MCP Server
FROM python:3.11-alpine AS builder
# Set working directory
WORKDIR /app
# Copy requirements file
COPY requirements.txt ./
# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Install PyInstaller
RUN pip install --no-cache-dir pyinstaller
# Copy source code
COPY . .
# Build the binary
RUN pyinstaller --onefile --name mcp-server main.py
# Final stage
FROM alpine:latest
# Install ca-certificates for HTTPS requests
RUN apk --no-cache add ca-certificates
# Create app directory
WORKDIR /app
# Copy binary from builder stage
COPY --from=builder /app/dist/mcp-server .
# Make binary executable
RUN chmod +x mcp-server
# Expose port (if running in HTTP mode)
EXPOSE 8080
# Set non-sensitive environment variables
ENV PORT="8080"
ENV TRANSPORT="http"
# Run the binary
CMD ["./mcp-server"]