Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 1 addition & 19 deletions build.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,9 @@ GIT_HASH=$(git rev-parse --short HEAD 2>/dev/null || echo "nogit")
VERSION="1.0.0+${BUILD_DATE}.${GIT_HASH}"
echo "Building with version: $VERSION"

if [ "$SKIP_EMBEDDINGS" = false ]; then
# Build the embeddings generator CLI tool
echo "Building embeddings generator..."
dotnet build csla-embeddings-generator/csla-embeddings-generator.csproj -c Release

# Run the embeddings generator to create embeddings.json
echo "Generating embeddings..."
dotnet run --project csla-embeddings-generator/csla-embeddings-generator.csproj --configuration Release -- --examples-path ./csla-examples --output ./embeddings.json
else
echo "Skipping embeddings generation (--skip-embeddings)"
fi

# If embeddings.json doesn't exist (e.g., missing Azure credentials), create an empty array JSON file
# This allows the Docker build to succeed, but semantic search will be disabled at runtime
if [ ! -f ./embeddings.json ]; then
echo "Warning: embeddings.json not created, creating empty file for Docker build"
echo "[]" > ./embeddings.json
fi

# Build the Docker container with the embeddings.json file and version embedded in assembly
echo "Building Docker container..."
docker build -t csla-mcp-server:latest \
--build-arg VERSION=$VERSION \
--build-arg SKIP_EMBEDDINGS=$SKIP_EMBEDDINGS \
-f csla-mcp-server/Dockerfile .
Comment thread
vijaygill marked this conversation as resolved.
15 changes: 14 additions & 1 deletion csla-mcp-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,26 @@ EXPOSE 8081
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
ARG BUILD_CONFIGURATION=Release
ARG VERSION=1.0.0
ARG SKIP_EMBEDDINGS=true
WORKDIR /src
COPY ["csla-mcp-server/csla-mcp-server.csproj", "csla-mcp-server/"]
RUN dotnet restore "./csla-mcp-server/csla-mcp-server.csproj"
COPY . .
WORKDIR "/src/csla-mcp-server"
RUN dotnet build "./csla-mcp-server.csproj" -c $BUILD_CONFIGURATION -o /app/build /p:InformationalVersion=$VERSION

# Generate the embeddings file if SKIP_EMBEDDINGS is false, otherwise create an empty file to avoid build errors in the final stage
RUN echo "[]" > /embeddings.json
# if SKIP_EMBEDDINGS is false, run the script to generate the embeddings file
RUN if [ "$SKIP_EMBEDDINGS" = "false" ]; then \
echo "Building embeddings generator..." \
dotnet build csla-embeddings-generator/csla-embeddings-generator.csproj -c Release \
echo "Generating embeddings..." \
dotnet run --project csla-embeddings-generator/csla-embeddings-generator.csproj --configuration Release -- --examples-path ./csla-examples --output /embeddings.json \
Comment thread
rockfordlhotka marked this conversation as resolved.
Outdated
Comment thread
rockfordlhotka marked this conversation as resolved.
Outdated
Comment thread
rockfordlhotka marked this conversation as resolved.
Outdated
else \
echo "Skipping embeddings generation..."; \
fi

# This stage is used to publish the service project to be copied to the final stage
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
Expand All @@ -32,5 +45,5 @@ COPY --from=build /src/csla-examples /csla-examples
WORKDIR /app
COPY --from=publish /app/publish .
# Copy pre-generated embeddings (created by build.sh script)
Comment thread
rockfordlhotka marked this conversation as resolved.
Outdated
COPY embeddings.json ./embeddings.json
COPY --from=build /embeddings.json ./embeddings.json
ENTRYPOINT ["dotnet", "csla-mcp-server.dll"]
Loading