76 lines
2.2 KiB
Docker
Executable File
76 lines
2.2 KiB
Docker
Executable File
# MarketAlly Context Plugin Dockerfile
|
|
# Multi-stage build for optimized production image
|
|
|
|
# Build stage
|
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
|
WORKDIR /src
|
|
|
|
# Copy project files
|
|
COPY ["MarketAlly.AIPlugin.Context.csproj", "."]
|
|
COPY ["../MarketAlly.AIPlugin/MarketAlly.AIPlugin.csproj", "../MarketAlly.AIPlugin/"]
|
|
|
|
# Restore dependencies
|
|
RUN dotnet restore "MarketAlly.AIPlugin.Context.csproj"
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
COPY ["../MarketAlly.AIPlugin/", "../MarketAlly.AIPlugin/"]
|
|
|
|
# Build the application
|
|
RUN dotnet build "MarketAlly.AIPlugin.Context.csproj" -c Release -o /app/build
|
|
|
|
# Publish stage
|
|
FROM build AS publish
|
|
RUN dotnet publish "MarketAlly.AIPlugin.Context.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
|
|
|
# Runtime stage
|
|
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
|
WORKDIR /app
|
|
|
|
# Install required packages for health checks and monitoring
|
|
RUN apt-get update && apt-get install -y \
|
|
curl \
|
|
procps \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Create non-root user for security
|
|
RUN groupadd -r contextapp && useradd -r -g contextapp contextapp
|
|
|
|
# Create directories with proper permissions
|
|
RUN mkdir -p /app/data/.context /app/logs /app/config && \
|
|
chown -R contextapp:contextapp /app
|
|
|
|
# Copy published application
|
|
COPY --from=publish /app/publish .
|
|
|
|
# Set ownership
|
|
RUN chown -R contextapp:contextapp /app
|
|
|
|
# Switch to non-root user
|
|
USER contextapp
|
|
|
|
# Environment variables
|
|
ENV ASPNETCORE_ENVIRONMENT=Production
|
|
ENV DOTNET_RUNNING_IN_CONTAINER=true
|
|
ENV DOTNET_USE_POLLING_FILE_WATCHER=true
|
|
ENV CONTEXT_STORAGE_PATH=/app/data/.context
|
|
ENV CONTEXT_LOG_LEVEL=Information
|
|
|
|
# Expose ports
|
|
EXPOSE 8080
|
|
EXPOSE 8081
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
|
CMD curl -f http://localhost:8081/health || exit 1
|
|
|
|
# Labels for metadata
|
|
LABEL maintainer="MarketAlly Team"
|
|
LABEL version="1.0.0"
|
|
LABEL description="MarketAlly AI Context Plugin"
|
|
LABEL org.opencontainers.image.source="https://github.com/marketally/aiplugin-context"
|
|
LABEL org.opencontainers.image.description="AI Context Management Plugin for conversation continuity"
|
|
LABEL org.opencontainers.image.licenses="MIT"
|
|
|
|
# Entry point
|
|
ENTRYPOINT ["dotnet", "MarketAlly.AIPlugin.Context.dll"] |