Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
README.md
docker-compose.yml
Dockerfile
4 changes: 2 additions & 2 deletions Risk.Server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
RUN apt-get update && apt-get install -y curl
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
COPY ["Risk.Server/Risk.Server.csproj", "Risk.Server/"]
COPY ["Risk.Shared/Risk.Shared.csproj", "Risk.Shared/"]
Expand Down
24 changes: 24 additions & 0 deletions Risk.Signalr.CS1400Client/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
RUN apt-get update && apt-get install -y curl
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
COPY ["Risk.Signalr.CS1400Client/Risk.Signalr.CS1400Client.csproj", "Risk.Signalr.CS1400Client/"]
COPY ["Risk.Shared/Risk.Shared.csproj", "Risk.Shared/"]
COPY ["Risk.Akka/Risk.Akka.csproj", "Risk.Akka/"]
RUN dotnet restore "Risk.Signalr.CS1400Client/Risk.Signalr.CS1400Client.csproj"
COPY . .
WORKDIR "/src/Risk.Signalr.CS1400Client"
RUN dotnet build "Risk.Signalr.CS1400Client.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Risk.Signalr.CS1400Client.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Risk.Signalr.CS1400Client.dll"]
6 changes: 6 additions & 0 deletions Risk.Signalr.CS1400Client/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Linq;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Threading;

namespace Risk.Signalr.CS1400Client
{
Expand Down Expand Up @@ -78,7 +79,12 @@ static async Task Main(string[] args)
Console.WriteLine("My connection id is " + hubConnection.ConnectionId);
await SignupAsync(playerName);
// just wait ....
while(true)
{
Thread.Sleep(1000);
}
Console.ReadLine();

}

static async Task SignupAsync(string playerName)
Expand Down
77 changes: 77 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
version: "3.9"

services:
risk-server:
build:
context: .
dockerfile: ./Risk.Server/Dockerfile
container_name: risk-server
ports:
- "5000:5000"
environment:
SECRET_CODE: "${SECRET_CODE:-banana55}" # default: banana55
SERVER_PORT: "${SERVER_PORT:-5000}" # default: 5000
command: [
"--StartGameCode",
"${SECRET_CODE:-banana55}",
"--urls",
"http://0.0.0.0:5000"
]
healthcheck:
test: ["CMD", "curl", "-f", "http://risk-server:5000/css/bootstrap/bootstrap.min.css"]
interval: 5s
retries: 3
timeout: 10s
start_period: 4s


cs1400-client:
build:
context: .
dockerfile: ./Risk.Signalr.CS1400Client/Dockerfile
container_name: cs1400-client
depends_on:
risk-server:
condition: service_healthy
environment:
SERVER_ADDRESS: "http://risk-server:5000"
PLAYER_NAME: "CS1400 Client"
command: [
"http://risk-server:5000",
"CS1400 Client"
]

# console-client:
# build:
# context: .
# dockerfile: ./Risk.Signalr.ConsoleClient/Dockerfile
# container_name: console-client
# depends_on:
# - risk-server
# environment:
# SERVER_ADDRESS: "http://risk-server:5000"
# PLAYER_NAME: "Console Client"
# command: [
# "dotnet",
# "Risk.Signalr.ConsoleClient.dll",
# "--serverAddress",
# "http://risk-server:5000",
# "--playerName",
# "Console Client"
# ]

# python-client:
# build:
# context: .
# dockerfile: ./Risk.Signalr.PythonClient/Dockerfile
# container_name: python-client
# depends_on:
# - risk-server
# environment:
# SERVER_ADDRESS: "risk-server"
# SERVER_PORT: "5000"
# PLAYER_NAME: "Python Client"
# command: [
# "python",
# "SampleRiskClient.py"
# ]