30 lines
972 B
Docker
30 lines
972 B
Docker
FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base
|
|
WORKDIR /app
|
|
EXPOSE 80
|
|
EXPOSE 443
|
|
|
|
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
|
WORKDIR /src
|
|
COPY ["GameServer/GameServer.csproj", "GameServer/"]
|
|
COPY ["TestClient/TestClient.csproj", "TestClient/"]
|
|
COPY ["Protocol/Protocol.csproj", "Protocol/"]
|
|
COPY ["LoginServer/LoginServer.csproj", "LoginServer/"]
|
|
COPY ["ServerCore/ServerCore.csproj", "ServerCore/"]
|
|
COPY ["ServerCommon/ServerCommon.csproj", "ServerCommon/"]
|
|
RUN dotnet restore "GameServer/GameServer.csproj"
|
|
COPY . .
|
|
WORKDIR "/src/GameServer"
|
|
RUN dotnet build "GameServer.csproj" -c Release -o /app/build
|
|
|
|
FROM build AS publish
|
|
RUN apt-get update -yq \
|
|
&& apt-get install curl gnupg -yq \
|
|
&& curl -sL https://deb.nodesource.com/setup_14.x | bash \
|
|
&& apt-get install nodejs -yq
|
|
RUN dotnet publish "GameServer.csproj" -c Release -o /app/publish
|
|
|
|
FROM base AS final
|
|
WORKDIR /app
|
|
COPY --from=publish /app/publish .
|
|
ENTRYPOINT ["dotnet", "GameServer.dll"]
|