mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
[ci] Multiarch build. Fix dockerfile.
This commit is contained in:
@@ -6,11 +6,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
name: Build Docker image
|
name: Build Docker image
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
arch: ['amd64', 'arm64']
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
@@ -39,7 +35,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: docker/Dockerfile.${{ matrix.arch }}
|
file: docker/Dockerfile.${{ matrix.arch }}
|
||||||
platforms: linux/${{ matrix.arch }}
|
platforms: linux/amd64,linux/arm64
|
||||||
push: ${{ github.ref == 'refs/heads/dev' }}
|
push: ${{ github.ref == 'refs/heads/dev' }}
|
||||||
tags: ${{ secrets.REGISTRY_URL }}/west/telegram-bot:latest,
|
tags: ${{ secrets.REGISTRY_URL }}/west/telegram-bot:latest,
|
||||||
${{ secrets.REGISTRY_URL }}/west/telegram-bot:${{ steps.commit_sha.outputs.sha_short }}
|
${{ secrets.REGISTRY_URL }}/west/telegram-bot:${{ steps.commit_sha.outputs.sha_short }}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
# 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
|
||||||
|
FROM mcr.microsoft.com/dotnet/aspnet:6.0.101-alpine3.14
|
||||||
|
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"]
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
# Build a project
|
# Build a project
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:6.0.1-alpine3.14-amd64 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:6.0.101-alpine3.14-amd64 AS build
|
||||||
WORKDIR /source
|
WORKDIR /source
|
||||||
|
|
||||||
# Copy project and perform restoring
|
# 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
|
rm -f /app/TelegramBot.*.dll /app/TelegramBot.*.pdb
|
||||||
|
|
||||||
# Now reuse image with only runtime
|
# Now reuse image with only runtime
|
||||||
FROM mcr.microsoft.com/dotnet/aspnet:6.0.1-alpine3.14-amd64
|
FROM mcr.microsoft.com/dotnet/aspnet:6.0.101-alpine3.14-amd64
|
||||||
WORKDIR /user
|
WORKDIR /user
|
||||||
COPY --from=build /app /app
|
COPY --from=build /app /app
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# Build a project
|
# Build a project
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:6.0.1-alpine3.14-arm64v8 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:6.0.101-alpine3.14-arm64v8 AS build
|
||||||
WORKDIR /source
|
WORKDIR /source
|
||||||
|
|
||||||
# Copy project and perform restoring
|
# 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
|
rm -f /app/TelegramBot.*.dll /app/TelegramBot.*.pdb
|
||||||
|
|
||||||
# Now reuse image with only runtime
|
# Now reuse image with only runtime
|
||||||
FROM mcr.microsoft.com/dotnet/aspnet:6.0.1-alpine3.14-arm64v8
|
FROM mcr.microsoft.com/dotnet/aspnet:6.0.101-alpine3.14-arm64v8
|
||||||
WORKDIR /user
|
WORKDIR /user
|
||||||
COPY --from=build /app /app
|
COPY --from=build /app /app
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user