-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (34 loc) · 1.78 KB
/
Copy pathDockerfile
File metadata and controls
46 lines (34 loc) · 1.78 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
# Stage 1: Build
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /src
# Copy solution and project infrastructure files first (for layer caching)
COPY global.json Directory.Build.props Directory.Packages.props nuget.config .editorconfig stash-mcp.slnx ./
COPY src/StashMcpServer/StashMcpServer.csproj src/StashMcpServer/
# Copy submodule project files and infrastructure for restore
COPY lib/Bitbucket.Net/Directory.Build.props lib/Bitbucket.Net/
COPY lib/Bitbucket.Net/Directory.Packages.props lib/Bitbucket.Net/
COPY lib/Bitbucket.Net/src/Bitbucket.Net/Bitbucket.Net.csproj lib/Bitbucket.Net/src/Bitbucket.Net/
# Restore as a separate layer
RUN dotnet restore src/StashMcpServer/StashMcpServer.csproj
# Copy remaining source files
COPY src/StashMcpServer/ src/StashMcpServer/
COPY lib/Bitbucket.Net/src/Bitbucket.Net/ lib/Bitbucket.Net/src/Bitbucket.Net/
COPY lib/Bitbucket.Net/.editorconfig lib/Bitbucket.Net/
# Publish as a framework-dependent application (multi-arch via base image)
RUN dotnet publish src/StashMcpServer/StashMcpServer.csproj \
--configuration Release \
--output /app \
--no-restore
# Stage 2: Runtime
FROM mcr.microsoft.com/dotnet/runtime:10.0 AS runtime
LABEL org.opencontainers.image.title="Stash MCP Server" \
org.opencontainers.image.description="MCP server for Bitbucket Server (Stash) — 41 tools for repositories, PRs, code review, builds, and search" \
org.opencontainers.image.url="https://github.com/diomonogatari/stash-mcp" \
org.opencontainers.image.source="https://github.com/diomonogatari/stash-mcp" \
org.opencontainers.image.licenses="MIT"
WORKDIR /app
COPY --from=build /app .
# Run as non-root for security (UID 1654 is the .NET default non-root user)
USER $APP_UID
STOPSIGNAL SIGTERM
ENTRYPOINT ["dotnet", "StashMcpServer.dll"]