diff --git a/src/.dockerignore b/src/.dockerignore index 5967294..58649f0 100644 --- a/src/.dockerignore +++ b/src/.dockerignore @@ -1,2 +1,6 @@ **/bin/ **/obj/ +/lubanAssistant/ +/packages/ +/TestResults/ +LubanTools.sln diff --git a/src/Luban.Client/Scripts/Dockerfile b/src/Luban.Client/Scripts/Dockerfile index c5a5131..72a42e4 100644 --- a/src/Luban.Client/Scripts/Dockerfile +++ b/src/Luban.Client/Scripts/Dockerfile @@ -2,16 +2,23 @@ FROM mcr.microsoft.com/dotnet/sdk:6.0 as build WORKDIR /app/Luban.Common COPY Luban.Common/*.csproj ./ -COPY Luban.Common/Source ./Source COPY Luban.Common/.editorconfig . COPY nuget.config ./nuget.config WORKDIR /app/Luban.Client COPY Luban.Client/Luban.Client.csproj ./ COPY Luban.Client/.editorconfig . -COPY Luban.Client/Source ./Source COPY nuget.config ./nuget.config +RUN dotnet restore + + +WORKDIR /app/Luban.Common +COPY Luban.Common/Source ./Source + +WORKDIR /app/Luban.Client +COPY Luban.Client/Source ./Source + RUN dotnet publish -c Release -o out FROM mcr.microsoft.com/dotnet/runtime:6.0 AS runtime diff --git a/src/Luban.ClientServer/Scripts/Dockerfile b/src/Luban.ClientServer/Scripts/Dockerfile new file mode 100644 index 0000000..fd13ec2 --- /dev/null +++ b/src/Luban.ClientServer/Scripts/Dockerfile @@ -0,0 +1,63 @@ +FROM mcr.microsoft.com/dotnet/sdk:6.0 as build + +WORKDIR /app/Luban.Common +COPY Luban.Common/*.csproj ./ +COPY Luban.Common/.editorconfig ./ + +WORKDIR /app/Luban.ClientServer.Common +COPY Luban.ClientServer.Common/*.csproj ./ +COPY nuget.config ./nuget.config + +WORKDIR /app/Luban.Job.Common +COPY Luban.Job.Common/*.csproj ./ +COPY nuget.config ./nuget.config + +WORKDIR /app/Luban.Job.Cfg +COPY Luban.Job.Cfg/*.csproj ./ +COPY nuget.config ./nuget.config + +WORKDIR /app/Luban.Job.Proto +COPY Luban.Job.Proto/*.csproj ./ +COPY nuget.config ./nuget.config + +WORKDIR /app/Luban.Job.Db +COPY Luban.Job.Db/*.csproj ./ +COPY nuget.config ./nuget.config + +WORKDIR /app/Luban.ClientServer +COPY Luban.ClientServer/Luban.ClientServer.csproj ./ +COPY Luban.ClientServer/.editorconfig . +COPY nuget.config ./nuget.config + +RUN dotnet restore + + +WORKDIR /app/Luban.Common +COPY Luban.Common/Source ./Source + +WORKDIR /app/Luban.ClientServer.Common +COPY Luban.ClientServer.Common/Source ./Source + +WORKDIR /app/Luban.Job.Common +COPY Luban.Job.Common/Source ./Source + +WORKDIR /app/Luban.Job.Cfg +COPY Luban.Job.Cfg/Source ./Source + +WORKDIR /app/Luban.Job.Proto +COPY Luban.Job.Proto/Source ./Source + +WORKDIR /app/Luban.Job.Db +COPY Luban.Job.Db/Source ./Source + +WORKDIR /app/Luban.ClientServer +COPY Luban.ClientServer/Source ./Source +COPY Luban.Server/Templates ./Templates + +RUN dotnet publish -c Release -o out + +FROM mcr.microsoft.com/dotnet/runtime:6.0 AS runtime +WORKDIR /app +COPY --from=build /app/Luban.ClientServer/out ./ +EXPOSE 8899/tcp +ENTRYPOINT ["/app/Luban.ClientServer", "-p", "8899"] \ No newline at end of file diff --git a/src/Luban.ClientServer/Scripts/build_docker.bat b/src/Luban.ClientServer/Scripts/build_docker.bat new file mode 100644 index 0000000..8bebffc --- /dev/null +++ b/src/Luban.ClientServer/Scripts/build_docker.bat @@ -0,0 +1,2 @@ +docker build -t luban-clientserver:latest -f Dockerfile ../.. +pause \ No newline at end of file diff --git a/src/Luban.ClientServer/Scripts/build_docker.sh b/src/Luban.ClientServer/Scripts/build_docker.sh new file mode 100644 index 0000000..f6f54d9 --- /dev/null +++ b/src/Luban.ClientServer/Scripts/build_docker.sh @@ -0,0 +1 @@ +docker build -t luban-clientserver:latest -f Dockerfile ../.. \ No newline at end of file diff --git a/src/Luban.ClientServer/Scripts/tag_and_push.bat b/src/Luban.ClientServer/Scripts/tag_and_push.bat new file mode 100644 index 0000000..6ef346c --- /dev/null +++ b/src/Luban.ClientServer/Scripts/tag_and_push.bat @@ -0,0 +1,3 @@ +docker tag luban-clientserver:latest focuscreativegames/luban-clientserver:latest +docker push focuscreativegames/luban-clientserver:latest +pause \ No newline at end of file diff --git a/src/Luban.ClientServer/Scripts/tag_and_push.sh b/src/Luban.ClientServer/Scripts/tag_and_push.sh new file mode 100644 index 0000000..75170c2 --- /dev/null +++ b/src/Luban.ClientServer/Scripts/tag_and_push.sh @@ -0,0 +1,2 @@ +docker tag luban-server:latest focuscreativegames/luban-server:latest +docker push focuscreativegames/luban-server:latest \ No newline at end of file diff --git a/src/Luban.Server/Scripts/Dockerfile b/src/Luban.Server/Scripts/Dockerfile index 5eac597..43e47c2 100644 --- a/src/Luban.Server/Scripts/Dockerfile +++ b/src/Luban.Server/Scripts/Dockerfile @@ -2,41 +2,57 @@ FROM mcr.microsoft.com/dotnet/sdk:6.0 as build WORKDIR /app/Luban.Common COPY Luban.Common/*.csproj ./ -COPY Luban.Common/Source ./Source -COPY Luban.Common/.editorconfig . -COPY nuget.config ./nuget.config +COPY Luban.Common/.editorconfig ./ WORKDIR /app/Luban.Server.Common COPY Luban.Server.Common/*.csproj ./ -COPY Luban.Server.Common/Source ./Source COPY nuget.config ./nuget.config WORKDIR /app/Luban.Job.Common COPY Luban.Job.Common/*.csproj ./ -COPY Luban.Job.Common/Source ./Source COPY nuget.config ./nuget.config WORKDIR /app/Luban.Job.Cfg COPY Luban.Job.Cfg/*.csproj ./ -COPY Luban.Job.Cfg/Source ./Source COPY nuget.config ./nuget.config WORKDIR /app/Luban.Job.Proto COPY Luban.Job.Proto/*.csproj ./ -COPY Luban.Job.Proto/Source ./Source COPY nuget.config ./nuget.config WORKDIR /app/Luban.Job.Db COPY Luban.Job.Db/*.csproj ./ -COPY Luban.Job.Db/Source ./Source COPY nuget.config ./nuget.config WORKDIR /app/Luban.Server COPY Luban.Server/Luban.Server.csproj ./ COPY Luban.Server/.editorconfig . +COPY nuget.config ./nuget.config + +RUN dotnet restore + + +WORKDIR /app/Luban.Common +COPY Luban.Common/Source ./Source + +WORKDIR /app/Luban.Server.Common +COPY Luban.Server.Common/Source ./Source + +WORKDIR /app/Luban.Job.Common +COPY Luban.Job.Common/Source ./Source + +WORKDIR /app/Luban.Job.Cfg +COPY Luban.Job.Cfg/Source ./Source + +WORKDIR /app/Luban.Job.Proto +COPY Luban.Job.Proto/Source ./Source + +WORKDIR /app/Luban.Job.Db +COPY Luban.Job.Db/Source ./Source + +WORKDIR /app/Luban.Server COPY Luban.Server/Source ./Source COPY Luban.Server/Templates ./Templates -COPY nuget.config ./nuget.config RUN dotnet publish -c Release -o out