1f3fb6e89e
PR Checks / test-and-build (pull_request) Successful in 13m32s
Telegram bot's long-polling hangs after the first GetUpdates request because libgssapi-krb5.so.2 is missing from the runtime-deps:10.0-noble final image. .NET runtime attempts dlopen() of libgssapi during the HTTPS handshake; without the library the HttpClient connection pool enters an unrecoverable state and TelegramBotService never receives new updates, even though SessionSchedulerService keeps sending outgoing messages successfully. Symptom (Loki, container gmrelaybot-bot-1): Telegram bot polling started Polling error, retrying in 5s Telegram.Bot.Exceptions.RequestException: Bot API Service Failure Cannot load library libgssapi_krb5.so.2 After the single Polling error, no Error handling update, no further Polling error, and getUpdates from outside returns [] forever. Fix: install libgssapi-krb5-2 alongside wget in the final stage of src/GmRelay.Bot/Dockerfile. This also future-proofs Npgsql GSS/SSPI Kerberos authentication for PostgreSQL. Closes #129. Bump version 3.9.5 -> 3.9.6
48 lines
1.9 KiB
Docker
48 lines
1.9 KiB
Docker
# Этап 1: Сборка с использованием .NET SDK
|
|
FROM mcr.microsoft.com/dotnet/sdk:10.0-noble AS build
|
|
|
|
# Установка зависимостей для Native AOT-компиляции (clang и zlib)
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
clang zlib1g-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Целевая архитектура для сборки (пробрасывается из Docker/Compose)
|
|
ARG TARGETARCH
|
|
|
|
WORKDIR /src
|
|
|
|
# Копирование проектов
|
|
COPY ["src/GmRelay.Bot/GmRelay.Bot.csproj", "src/GmRelay.Bot/"]
|
|
COPY ["src/GmRelay.ServiceDefaults/GmRelay.ServiceDefaults.csproj", "src/GmRelay.ServiceDefaults/"]
|
|
|
|
# Восстановление зависимостей с учетом архитектуры
|
|
RUN dotnet restore "src/GmRelay.Bot/GmRelay.Bot.csproj" -a $TARGETARCH
|
|
|
|
# Копирование остального исходного кода
|
|
COPY src/ src/
|
|
|
|
WORKDIR /src/src/GmRelay.Bot
|
|
|
|
# Публикация AOT-бинарного файла
|
|
RUN dotnet publish "GmRelay.Bot.csproj" -c Release -a $TARGETARCH -o /app/publish
|
|
|
|
# Этап 2: Runtime (runtime-deps содержит только ОС-зависимости, без .NET Runtime)
|
|
FROM mcr.microsoft.com/dotnet/runtime-deps:10.0-noble AS final
|
|
WORKDIR /app
|
|
|
|
# Устанавливаем wget для healthcheck и libgssapi-krb5-2 для Npgsql GSS/SSPI
|
|
# и HTTPS-handshake Telegram.Bot (без неё long-polling падает на первом запросе).
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
wget libgssapi-krb5-2 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Копируем только AOT-результаты из билда
|
|
COPY --from=build /app/publish .
|
|
|
|
EXPOSE 8081
|
|
|
|
USER $APP_UID
|
|
|
|
# Запуск скомпилированного AOT бинарного файла напрямую
|
|
ENTRYPOINT ["./GmRelay.Bot"]
|