Files
mcp-microsoft/Dockerfile
T
Anu Thomas 91d7d5952a Docker: Use runtime-deps base image (#1782)
* Docker: update mcr base image from aspnet to runtime-deps

* amend changelog to include trimmed docker image savings

* Update VersionSyncTests to support runtime-deps base image in Dockerfile
2026-02-22 15:22:00 -08:00

38 lines
1.1 KiB
Docker

# Build the runtime image
FROM mcr.microsoft.com/dotnet/runtime-deps:10.0-alpine AS runtime
# Add build argument for publish directory
ARG PUBLISH_DIR
# Error out if PUBLISH_DIR is not set
RUN if [ -z "$PUBLISH_DIR" ]; then \
echo "ERROR: PUBLISH_DIR build argument is required" && exit 1; \
fi
# Add build argument for executable name
ARG EXECUTABLE_NAME
# Error out if EXECUTABLE_NAME is not set
RUN if [ -z "$EXECUTABLE_NAME" ]; then \
echo "ERROR: EXECUTABLE_NAME build argument is required" && exit 1; \
fi
# Copy the contents of the publish directory to '/mcp-server' and set it as the working directory
RUN mkdir -p /mcp-server
COPY ${PUBLISH_DIR} /mcp-server/
WORKDIR /mcp-server
# List the contents of the current directory
RUN ls -la
# Ensure the server binary exists
RUN if [ ! -f $EXECUTABLE_NAME ]; then \
echo "ERROR: $EXECUTABLE_NAME executable does not exist" && exit 1; \
fi
# Copy the server binary to a known location and make it executable
COPY ${PUBLISH_DIR}/${EXECUTABLE_NAME} server-binary
RUN chmod +x server-binary && test -x server-binary
ENTRYPOINT ["./server-binary", "server", "start"]