split Dockerfile, dynamic backend URL

This commit is contained in:
Vinzenz Schroeter 2024-04-21 14:34:45 +02:00
parent 8d09663eff
commit 3d69f592f6
15 changed files with 75 additions and 60 deletions

View file

@ -0,0 +1,13 @@
**/.dockerignore
**/.env
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/.idea
**/*.*proj.user
**/bin
**/Dockerfile*
**/obj

26
tanks-backend/Dockerfile Normal file
View file

@ -0,0 +1,26 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build-server
RUN apk add clang binutils musl-dev build-base zlib-static cmake openssl-dev openssl-libs-static openssl
WORKDIR /src/tanks-server
# dependencies
COPY ./shared.props .
COPY ./TanksServer.sln .
COPY ./EndiannessSourceGenerator/EndiannessSourceGenerator.csproj EndiannessSourceGenerator/EndiannessSourceGenerator.csproj
COPY ./DisplayCommands/DisplayCommands.csproj DisplayCommands/DisplayCommands.csproj
COPY ./TanksServer/TanksServer.csproj TanksServer/TanksServer.csproj
RUN dotnet restore --runtime linux-musl-x64 TanksServer.sln
#build
COPY . .
RUN dotnet build TanksServer/TanksServer.csproj -c Release -r linux-musl-x64 -o /build
RUN dotnet publish TanksServer/TanksServer.csproj -c Release -r linux-musl-x64 -o /app
FROM mcr.microsoft.com/dotnet/runtime-deps:8.0-alpine AS final
WORKDIR /app
COPY --from=build-server /app .
EXPOSE 80
ENTRYPOINT ./TanksServer

View file

@ -4,11 +4,6 @@
<PropertyGroup>
<PublishAot>true</PublishAot>
<IlcDisableReflection>false</IlcDisableReflection>
<StaticExecutable>true</StaticExecutable>
<StripSymbols>true</StripSymbols>
<StaticallyLinked>true</StaticallyLinked>
</PropertyGroup>
<ItemGroup>
@ -18,9 +13,7 @@
</ItemGroup>
<ItemGroup>
<None Include="./assets/tank.png" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="Always"/>
<!-- TODO include maps in release -->
<None Include="./assets/maps/**" CopyToOutputDirectory="PreserveNewest"/>
<None Include="./assets/**" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="Always"/>
</ItemGroup>
</Project>

View file

@ -11,7 +11,7 @@
"Kestrel": {
"Endpoints": {
"Http": {
"Url": "http://localhost:3000"
"Url": "http://0.0.0.0:3000"
}
}
},