diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index 57cf1b0..c66de99 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -2,13 +2,11 @@ on: push: - branches: - - 'dev' jobs: docker: name: Build Docker image - + runs-on: ubuntu-latest steps: - @@ -27,11 +25,15 @@ jobs: registry: ${{ secrets.REGISTRY_URL }} username: ${{ secrets.REGISTRY_USERNAME }} password: ${{ secrets.REGISTRY_PASSWORD }} + - + name: Get short commit SHA + id: commit_sha + run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" - name: Build and push uses: docker/build-push-action@v2 with: - context: . - file: docker/Dockerfile.amd64 - push: true - tags: ${{ secrets.REGISTRY_URL }}/west/telegram-bot:latest,${{ secrets.REGISTRY_URL }}/west/telegram-bot:${{ github.sha }} \ No newline at end of file + platforms: linux/amd64,linux/arm64 + push: ${{ github.ref == 'refs/heads/dev' }} + tags: ${{ secrets.REGISTRY_URL }}/west/telegram-bot:latest, + ${{ secrets.REGISTRY_URL }}/west/telegram-bot:${{ steps.commit_sha.outputs.sha_short }} \ No newline at end of file diff --git a/Core/Core.csproj b/Core/Core.csproj index 11d7178..bb41840 100644 --- a/Core/Core.csproj +++ b/Core/Core.csproj @@ -1,22 +1,22 @@ - net5.0 + net6.0 TelegramBot Kruzya.TelegramBot.Core - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - + + + + diff --git a/docker/Dockerfile.amd64 b/Dockerfile similarity index 91% rename from docker/Dockerfile.amd64 rename to Dockerfile index a0f24e4..7877b99 100644 --- a/docker/Dockerfile.amd64 +++ b/Dockerfile @@ -1,5 +1,5 @@ -# Build a project -FROM mcr.microsoft.com/dotnet/sdk:5.0.404-alpine3.14-amd64 AS build +# Build a project +FROM mcr.microsoft.com/dotnet/sdk:6.0.101-alpine3.14 AS build WORKDIR /source # Copy project and perform restoring @@ -23,7 +23,7 @@ RUN dotnet publish -c release -o /app --no-restore Kruzya.TelegramBot.sln && \ rm -f /app/TelegramBot.*.dll /app/TelegramBot.*.pdb # Now reuse image with only runtime -FROM mcr.microsoft.com/dotnet/aspnet:5.0.13-alpine3.14-amd64 +FROM mcr.microsoft.com/dotnet/aspnet:6.0.1-alpine3.14 WORKDIR /user COPY --from=build /app /app diff --git a/docker/Dockerfile.aarch64 b/docker/Dockerfile.aarch64 deleted file mode 100644 index fad6347..0000000 --- a/docker/Dockerfile.aarch64 +++ /dev/null @@ -1,44 +0,0 @@ -# Build a project -FROM mcr.microsoft.com/dotnet/sdk:5.0.404-buster-slim-arm64v8 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 -FROM mcr.microsoft.com/dotnet/aspnet:5.0.13-alpine3.14-arm64v8 -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"] diff --git a/modules/ChatManagement/ChatManagement.csproj b/modules/ChatManagement/ChatManagement.csproj index dc8f81f..ff72078 100644 --- a/modules/ChatManagement/ChatManagement.csproj +++ b/modules/ChatManagement/ChatManagement.csproj @@ -1,7 +1,7 @@ - net5.0 + net6.0 TelegramBot.ChatManagement West.TelegramBot.ChatManagement diff --git a/modules/CombotAntiSpam/CombotAntiSpam.csproj b/modules/CombotAntiSpam/CombotAntiSpam.csproj index ada4e7e..e2f3e82 100644 --- a/modules/CombotAntiSpam/CombotAntiSpam.csproj +++ b/modules/CombotAntiSpam/CombotAntiSpam.csproj @@ -1,7 +1,7 @@ - net5.0 + net6.0 TelegramBot.CombotAntiSpam Kruzya.TelegramBot.CombotAntiSpam diff --git a/modules/Destiny2.WhereIsXur/Destiny2.WhereIsXur.csproj b/modules/Destiny2.WhereIsXur/Destiny2.WhereIsXur.csproj index eb91cf1..1e8fa06 100644 --- a/modules/Destiny2.WhereIsXur/Destiny2.WhereIsXur.csproj +++ b/modules/Destiny2.WhereIsXur/Destiny2.WhereIsXur.csproj @@ -1,7 +1,7 @@ - net5.0 + net6.0 TelegramBot.D2_WhereIsXur Kruzya.TelegramBot.Destiny2.WhereIsXur @@ -11,8 +11,8 @@ - - + + diff --git a/modules/Entertainment/Entertainment.csproj b/modules/Entertainment/Entertainment.csproj index 609decc..5a62490 100644 --- a/modules/Entertainment/Entertainment.csproj +++ b/modules/Entertainment/Entertainment.csproj @@ -1,7 +1,7 @@ - net5.0 + net6.0 TelegramBot.Entertainment West.Entertainment diff --git a/modules/RichSiteSummary/RichSiteSummary.csproj b/modules/RichSiteSummary/RichSiteSummary.csproj index c82745b..7341b84 100644 --- a/modules/RichSiteSummary/RichSiteSummary.csproj +++ b/modules/RichSiteSummary/RichSiteSummary.csproj @@ -1,7 +1,7 @@ - net5.0 + net6.0 TelegramBot.RichSiteSummary Kruzya.TelegramBot.RichSiteSummary @@ -11,7 +11,7 @@ - + diff --git a/modules/UrlLimitations/UrlLimitations.csproj b/modules/UrlLimitations/UrlLimitations.csproj index 2a7e32e..09c082d 100644 --- a/modules/UrlLimitations/UrlLimitations.csproj +++ b/modules/UrlLimitations/UrlLimitations.csproj @@ -1,7 +1,7 @@ - net5.0 + net6.0 TelegramBot.UrlLimitations Kruzya.TelegramBot.UrlLimitations diff --git a/modules/UserGroupTag/UserGroupTag.csproj b/modules/UserGroupTag/UserGroupTag.csproj index 686ce30..2c5932d 100644 --- a/modules/UserGroupTag/UserGroupTag.csproj +++ b/modules/UserGroupTag/UserGroupTag.csproj @@ -1,7 +1,7 @@ - net5.0 + net6.0 TelegramBot.UserGroupTag diff --git a/tests/Tests.csproj b/tests/Tests.csproj index 5e99fe4..d25df7c 100644 --- a/tests/Tests.csproj +++ b/tests/Tests.csproj @@ -1,7 +1,7 @@ - net5.0 + net6.0 false @@ -11,9 +11,9 @@ - - - + + +