Sign inSign up

dreamplay/serena

By dreamplay

•Updated about 1 year ago

打包serena代码,用于迅速运行开启sse服务

Image
Machine learning & AI
0

418

dreamplay/serena repository overview

⁠打包

# Base stage with common dependencies
FROM python:3.11-slim AS base
SHELL ["/bin/bash", "-c"]

# Set environment variables to make Python print directly to the terminal and avoid .pyc files.
ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1

# Install system dependencies required for package manager and build tools.
RUN apt-get update && apt-get install -y --no-install-recommends \
    curl \
    build-essential \
    git \
    ssh \
    nodejs \
    npm \
    && rm -rf /var/lib/apt/lists/*

# Install pipx.
RUN python3 -m pip install --no-cache-dir pipx \
    && pipx ensurepath

# Add local bin to the path
ENV PATH="${PATH}:/root/.local/bin"

# Install the latest version of uv
RUN curl -LsSf https://astral.sh/uv/install.sh | sh

# Set the working directory
WORKDIR /workspaces/serena

# Install node package
RUN npm install --prefix ./ [email protected]

# Production target
FROM base AS production
# Copy only necessary files for production
COPY pyproject.toml /workspaces/serena/
COPY README.md /workspaces/serena/
COPY src/ /workspaces/serena/src/

# Create virtual environment and install dependencies (production only)
RUN uv venv
RUN . .venv/bin/activate
RUN uv pip install -r pyproject.toml -e .
ENV PATH="/workspaces/serena/.venv/bin:${PATH}"

# Entrypoint to ensure environment is activated
ENTRYPOINT ["/bin/bash", "-c", "source .venv/bin/activate && $0 $@"]

主要是需要增加语言功能

# node项目能力
RUN apt install nodejs
RUN npm install --prefix ./ [email protected]

# go项目能力
RUN apt install golang gopls
  • 第三步:打包镜像
docker build -t dreamplay/serena:latest .
  • 第四步:推送镜像
docker push dreamplay/serena:latest

⁠使用

services:
  serena:
    image: dreamplay/serena:latest
    environment:
      - SERENA_DOCKER=1
    volumes:
      - ./projects:/projects
    ports:
      - "9121:9121"  # MCP server port
      - "24282:24282"  # Dashboard port
    command:
      - "uv run --directory . serena-mcp-server --transport sse --port 9121 --host 0.0.0.0"

⁠sse接口

⁠参考

Tag summary

Content type

Image

Digest

sha256:90abe2a74…

Size

327.8 MB

Last updated

about 1 year ago

docker pull dreamplay/serena