-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile
More file actions
64 lines (49 loc) · 1.95 KB
/
Dockerfile
File metadata and controls
64 lines (49 loc) · 1.95 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
55
56
57
58
59
60
61
62
63
64
# Calendar MCP HTTP Server - Multi-stage Docker build
# Build: docker build -t calendar-mcp-http .
# Run: docker run -p 8080:8080 -v calendar-mcp-data:/app/data calendar-mcp-http
# Stage 1: Build
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /src
# Copy project files for layer caching
# Directory.Build.props lives at the repo root and is auto-imported by MSBuild
# from the parent of each .csproj, so we drop it next to the projects in /src.
COPY Directory.Build.props ./
COPY src/CalendarMcp.Core/CalendarMcp.Core.csproj CalendarMcp.Core/
COPY src/CalendarMcp.Auth/CalendarMcp.Auth.csproj CalendarMcp.Auth/
COPY src/CalendarMcp.HttpServer/CalendarMcp.HttpServer.csproj CalendarMcp.HttpServer/
# Restore dependencies
RUN dotnet restore CalendarMcp.HttpServer/CalendarMcp.HttpServer.csproj
# Copy all source files
COPY src/CalendarMcp.Core/ CalendarMcp.Core/
COPY src/CalendarMcp.Auth/ CalendarMcp.Auth/
COPY src/CalendarMcp.HttpServer/ CalendarMcp.HttpServer/
# Build
RUN dotnet build CalendarMcp.HttpServer/CalendarMcp.HttpServer.csproj \
-c Release \
-o /app/build
# Publish
RUN dotnet publish CalendarMcp.HttpServer/CalendarMcp.HttpServer.csproj \
-c Release \
-o /app/publish \
/p:UseAppHost=false
# Stage 2: Runtime
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime
WORKDIR /app
# Create non-root user for security
RUN groupadd -r mcpuser && useradd -r -g mcpuser -d /app -s /sbin/nologin mcpuser
# Create data directories
RUN mkdir -p /app/data/logs /app/data/tokens && \
chown -R mcpuser:mcpuser /app
# Copy published application
COPY --from=build /app/publish .
# Set environment variables
ENV ASPNETCORE_URLS=http://+:8080
ENV CALENDAR_MCP_CONFIG=/app/data
# Health check
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -f http://localhost:8080/health || exit 1
# Expose MCP and admin ports
EXPOSE 8080
# Switch to non-root user
USER mcpuser
ENTRYPOINT ["dotnet", "CalendarMcp.HttpServer.dll"]