2021-12-21 23:49:15 +04:00
|
|
|
# Build a project
|
2021-12-25 20:08:40 +04:00
|
|
|
FROM mcr.microsoft.com/dotnet/sdk:5.0.404-buster-slim-arm64v8 AS build
|
2021-12-21 23:49:15 +04:00
|
|
|
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/
|
|
|
|
|
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,pdb,json}
|
|
|
|
|
|
|
|
|
|
# Now reuse image with only runtime
|
2021-12-25 20:08:40 +04:00
|
|
|
FROM mcr.microsoft.com/dotnet/aspnet:5.0.13-alpine3.14-arm64v8
|
2021-12-21 23:49:15 +04:00
|
|
|
WORKDIR /user
|
|
|
|
|
COPY --from=build /app /app
|
|
|
|
|
ENTRYPOINT ["dotnet", "/app/TelegramBot.dll"]
|