Skip to content

Commit

Permalink
Fix docker files
Browse files Browse the repository at this point in the history
  • Loading branch information
Waterball12 committed Feb 24, 2021
1 parent af5e381 commit f0c78d1
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 20 deletions.
6 changes: 3 additions & 3 deletions server/src/ApiGateways/Web/Web.API/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build
WORKDIR /src
COPY ["ApiGateways/Web.API/Web.API.csproj", "ApiGateways/Web.API/"]
RUN dotnet restore "ApiGateways/Web.API/Web.API.csproj"
COPY ["ApiGateways/Web/Web.API/Web.API.csproj", "ApiGateways/Web/Web.API/"]
RUN dotnet restore "ApiGateways/Web/Web.API/Web.API.csproj"
COPY . .
WORKDIR "/src/ApiGateways/Web.API"
WORKDIR "/src/ApiGateways/Web/Web.API"
RUN dotnet build "Web.API.csproj" -c Release -o /app/build

FROM build AS publish
Expand Down
2 changes: 1 addition & 1 deletion server/src/ApiGateways/Web/Web.API/Web.API.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net5.0</TargetFramework>
<UserSecretsId>22fd137b-c4ae-4929-af28-14daba3ac0f1</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
<DockerfileContext>..\..\..</DockerfileContext>
</PropertyGroup>

<ItemGroup>
Expand Down
7 changes: 4 additions & 3 deletions server/src/ApiGateways/WebSocket/Web.Socket/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build
WORKDIR /src
COPY ["ApiGateways/Web.Socket/Web.Socket.csproj", "ApiGateways/Web.Socket/"]
RUN dotnet restore "ApiGateways/Web.Socket/Web.Socket.csproj"
COPY ["ApiGateways/WebSocket/Web.Socket/Web.Socket.csproj", "ApiGateways/WebSocket/Web.Socket/"]
COPY ["Services/Quizer/Quiz.Domain/Quizzer.Domain.csproj", "Services/Quizer/Quiz.Domain/"]
RUN dotnet restore "ApiGateways/WebSocket/Web.Socket/Web.Socket.csproj"
COPY . .
WORKDIR "/src/ApiGateways/Web.Socket"
WORKDIR "/src/ApiGateways/WebSocket/Web.Socket"
RUN dotnet build "Web.Socket.csproj" -c Release -o /app/build

FROM build AS publish
Expand Down
5 changes: 0 additions & 5 deletions server/src/ApiGateways/WebSocket/Web.Socket/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseKestrel((hosting, options) =>
{
options.ListenAnyIP(4900);
});

webBuilder.UseStartup<Startup>();
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>net5.0</TargetFramework>
<UserSecretsId>eb30d72d-553c-4ff4-9603-f4a29563d64c</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
<DockerfileContext>..\..\..</DockerfileContext>
</PropertyGroup>

<ItemGroup>
Expand Down
10 changes: 9 additions & 1 deletion server/src/ApiGateways/WebSocket/Web.Socket/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,13 @@
}
},
"AllowedHosts": "*",
"QuizGrpcApi": "http://localhost:6000"
"QuizGrpcApi": "http://localhost:6000",
"RabbitMQConnection": "rabbitmq://localhost",
"Kestrel": {
"Endpoints": {
"Http": {
"Url": "http://localhost:4900"
}
}
}
}
14 changes: 8 additions & 6 deletions server/src/Services/Quizer/Quiz.API/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@ EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim AS build
WORKDIR /src
COPY ["Services/Quiz/Quiz.API/Quiz.API.csproj", "Services/Quiz/Quiz.API/"]
RUN dotnet restore "Services/Quiz/Quiz.API/Quiz.API.csproj"
COPY ["Services/Quizer/Quiz.API/Quizzer.API.csproj", "Services/Quizer/Quiz.API/"]
COPY ["Services/Quizer/Quiz.Infrastructure/Quizzer.Infrastructure.csproj", "Services/Quizer/Quiz.Infrastructure/"]
COPY ["Services/Quizer/Quiz.Domain/Quizzer.Domain.csproj", "Services/Quizer/Quiz.Domain/"]
RUN dotnet restore "Services/Quizer/Quiz.API/Quizzer.API.csproj"
COPY . .
WORKDIR "/src/Services/Quiz/Quiz.API"
RUN dotnet build "Quiz.API.csproj" -c Release -o /app/build
WORKDIR "/src/Services/Quizer/Quiz.API"
RUN dotnet build "Quizzer.API.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Quiz.API.csproj" -c Release -o /app/publish
RUN dotnet publish "Quizzer.API.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Quiz.API.dll"]
ENTRYPOINT ["dotnet", "Quizzer.API.dll"]
1 change: 1 addition & 0 deletions server/src/Services/Quizer/Quiz.API/Quizzer.API.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

<ItemGroup>
<PackageReference Include="Grpc.AspNetCore" Version="2.34.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.9" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit f0c78d1

Please sign in to comment.