diff --git a/Dockerfile b/Dockerfile index f6929df..0c10dca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ FROM mcr.microsoft.com/dotnet/runtime:5.0 AS base WORKDIR /app FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build -WORKDIR /src +WORKDIR /code COPY ["src/Ray.BiliBiliTool.Console/Ray.BiliBiliTool.Console.csproj", "src/Ray.BiliBiliTool.Console/"] COPY ["src/Ray.BiliBiliTool.DomainService/Ray.BiliBiliTool.DomainService.csproj", "src/Ray.BiliBiliTool.DomainService/"] COPY ["src/Ray.BiliBiliTool.Config/Ray.BiliBiliTool.Config.csproj", "src/Ray.BiliBiliTool.Config/"] @@ -22,7 +22,7 @@ COPY ["src/Ray.Serilog.Sinks/Ray.Serilog.Sinks.PushPlusBatched/Ray.Serilog.Sinks COPY ["src/Ray.Serilog.Sinks/Ray.Serilog.Sinks.ServerChanBatched/Ray.Serilog.Sinks.ServerChanBatched.csproj", "src/Ray.Serilog.Sinks/Ray.Serilog.Sinks.ServerChanBatched/"] RUN dotnet restore "src/Ray.BiliBiliTool.Console/Ray.BiliBiliTool.Console.csproj" COPY . . -WORKDIR "/src/src/Ray.BiliBiliTool.Console" +WORKDIR "/code/src/Ray.BiliBiliTool.Console" RUN dotnet build "Ray.BiliBiliTool.Console.csproj" -c Release -o /app/build FROM build AS publish diff --git a/docker/build/buildAndPushImage_multiArch.cmd b/docker/build/buildAndPushImage_multiArch.cmd new file mode 100644 index 0000000..be997db --- /dev/null +++ b/docker/build/buildAndPushImage_multiArch.cmd @@ -0,0 +1,11 @@ +@echo off + +REM start to build +REM https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/ +REM https://segmentfault.com/a/1190000021166703 +REM linux/arm/v6,linux/riscv64,linux/s390x,linux/ppc64le,linux/386,,linux/arm/v7 偶发异常,待进一步测试 +echo Start to build docker image with multi-arch +@echo on +docker buildx build --platform linux/amd64,linux/arm64 --push -t zai7lou/bilibili_tool ../.. +@echo off +pause diff --git a/docker/buildImage.cmd b/docker/build/buildImage.cmd similarity index 66% rename from docker/buildImage.cmd rename to docker/build/buildImage.cmd index bcc23c7..10838d3 100644 --- a/docker/buildImage.cmd +++ b/docker/build/buildImage.cmd @@ -3,6 +3,6 @@ REM start to build echo Start to build docker image @echo on -docker build -t zai7lou/bilibili_tool .. +docker build -t zai7lou/bilibili_tool ../.. @echo off pause diff --git a/docker/build/buildImage_amd64.cmd b/docker/build/buildImage_amd64.cmd new file mode 100644 index 0000000..461cda8 --- /dev/null +++ b/docker/build/buildImage_amd64.cmd @@ -0,0 +1,10 @@ +@echo off + +REM start to build +REM https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/ +REM https://segmentfault.com/a/1190000021166703 +echo Start to build docker image with amd64-arch +@echo on +docker buildx build --platform linux/amd64 -o type=docker -t zai7lou/bilibili_tool ../.. +@echo off +pause diff --git a/docker/build/buildImage_arm64.cmd b/docker/build/buildImage_arm64.cmd new file mode 100644 index 0000000..749c9aa --- /dev/null +++ b/docker/build/buildImage_arm64.cmd @@ -0,0 +1,10 @@ +@echo off + +REM start to build +REM https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/ +REM https://segmentfault.com/a/1190000021166703 +echo Start to build docker image with arm64-arch +@echo on +docker buildx build --platform linux/arm64 -o type=docker -t zai7lou/bilibili_tool ../.. +@echo off +pause