-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
54 lines (41 loc) · 1.55 KB
/
Dockerfile
File metadata and controls
54 lines (41 loc) · 1.55 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
# Build stage
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /source
# Copy solution and project files
COPY csharp-mcp.slnx .
COPY Directory.Packages.props .
COPY src/InfinityFlow.CSharp.Eval/*.csproj ./src/InfinityFlow.CSharp.Eval/
COPY tests/InfinityFlow.CSharp.Eval.Tests/*.csproj ./tests/InfinityFlow.CSharp.Eval.Tests/
# Restore dependencies
RUN dotnet restore
# Copy source code
COPY src/ ./src/
COPY tests/ ./tests/
COPY examples/ ./examples
# Build and test
RUN dotnet build -c Release --no-restore
RUN dotnet test -c Release --no-build --verbosity normal
# Publish
RUN dotnet publish src/InfinityFlow.CSharp.Eval/InfinityFlow.CSharp.Eval.csproj -c Release -o /app/publish --no-restore
# Runtime stage - Use SDK for NuGet package resolution
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS runtime
WORKDIR /app
# Install required dependencies for Roslyn scripting
RUN apt-get update && apt-get install -y \
libicu-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy published app
COPY --from=build /app/publish .
# Create directories for NuGet packages
RUN mkdir -p /tmp/csharp-mcp-packages && \
chmod 777 /tmp/csharp-mcp-packages
# Create non-root user
RUN useradd -m -s /bin/bash mcpuser && \
chown -R mcpuser:mcpuser /app
USER mcpuser
# Set NuGet package cache directory
ENV NUGET_PACKAGES=/tmp/csharp-mcp-packages
# Indicate we're running in a container
ENV DOTNET_RUNNING_IN_CONTAINER=true
# The MCP server uses stdio for communication
ENTRYPOINT ["dotnet", "/app/InfinityFlow.CSharp.Eval.dll"]