Files
ttychart-mcp/Dockerfile

44 lines
892 B
Docker

# ttychart-mcp 终端图表 MCP 服务 Docker 镜像
#
# 使用方法:
# docker build -t ttychart-mcp .
# docker run -p 3100:3100 ttychart-mcp
#
# 作者: titor
# 创建日期: 2026-04-15
FROM golang:1.26-debian13 AS builder
# 设置工作目录
WORKDIR /build
# 设置 Go 国内代理
ENV GOPROXY=https://goproxy.cn,direct
ENV GO111MODULE=on
# 复制依赖文件
COPY go.mod go.sum ./
RUN go mod download
# 复制源代码
COPY . .
# 构建二进制
RUN CGO_ENABLED=0 GOOS=linux go build -o ttychart-mcp .
# 最终镜像
FROM debian:bookworm-slim
# 安装 ca-certificates 用于 HTTPS
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates && rm -rf /var/lib/apt/lists/*
# 设置工作目录
WORKDIR /app
# 从 builder 阶段复制二进制
COPY --from=builder /build/ttychart-mcp .
# 暴露端口
EXPOSE 3100
# 启动命令
CMD ["/app/ttychart-mcp"]