Files
telegram-bot/Dockerfile
T

45 lines
1.7 KiB
Docker
Raw Normal View History

2022-01-10 01:01:38 +02:00
# Build a project
FROM mcr.microsoft.com/dotnet/sdk:6.0.101-alpine3.14 AS build
WORKDIR /source
# Copy project and perform restoring
COPY Kruzya.TelegramBot.sln ./
COPY ./Core/*.csproj ./Core/
COPY ./tests/*.csproj ./tests/
COPY ./modules/CombotAntiSpam/*.csproj ./modules/CombotAntiSpam/
COPY ./modules/Destiny2.WhereIsXur/*.csproj ./modules/Destiny2.WhereIsXur/
COPY ./modules/RichSiteSummary/*.csproj ./modules/RichSiteSummary/
COPY ./modules/UrlLimitations/*.csproj ./modules/UrlLimitations/
COPY ./modules/ChatManagement/*.csproj ./modules/ChatManagement/
COPY ./modules/Entertainment/*.csproj ./modules/Entertainment/
COPY ./modules/UserGroupTag/*.csproj ./modules/UserGroupTag/
RUN dotnet restore Kruzya.TelegramBot.sln
# Copy all project files
COPY . .
RUN dotnet publish -c release -o /app --no-restore Kruzya.TelegramBot.sln && \
mkdir /app/modules && \
cp /app/TelegramBot.*.dll /app/modules/ && \
rm -f /app/TelegramBot.*.dll /app/TelegramBot.*.pdb
# Now reuse image with only runtime
2022-01-10 01:05:02 +02:00
FROM mcr.microsoft.com/dotnet/aspnet:6.0.1-alpine3.14
2022-01-10 01:01:38 +02:00
WORKDIR /user
COPY --from=build /app /app
ENV MUSL_LOCPATH /usr/share/i18n/locales/musl
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false
RUN apk add --no-cache cmake make musl-dev gcc gettext-dev libintl icu-libs \
&& wget https://gitlab.com/rilian-la-te/musl-locales/-/archive/master/musl-locales-master.zip \
&& unzip musl-locales-master.zip \
&& cd musl-locales-master \
&& cmake -DLOCALE_PROFILE=OFF -D CMAKE_INSTALL_PREFIX:PATH=/usr . && make && make install \
&& cd .. && rm -r musl-locales-master
ENV LANG ru_RU.UTF-8
ENV LANGUAGE ru_RU.UTF-8
ENV LC_ALL ru_RU.UTF-8
ENTRYPOINT ["dotnet", "/app/TelegramBot.dll"]