Files
Alchegos.MCP/Dockerfile
2025-05-04 19:11:12 +01:00

34 lines
1.0 KiB
Docker

FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
WORKDIR /app
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY NuGet.Config ./
COPY ["*.sln", "."]
COPY ["Alchegos.MCP.csproj", "./"]
RUN dotnet restore "Alchegos.MCP.csproj"
COPY . .
WORKDIR "/src/"
RUN dotnet build "./Alchegos.MCP.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./Alchegos.MCP.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
USER root
RUN apt-get update
RUN apt-get install -y --no-install-recommends openssh-client openssh-server
RUN rm -rf /var/lib/apt/lists/*
RUN mkdir -p /var/run/sshd
RUN sed -i 's/#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed -i 's/#PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]