Ist es möglich, eine .NET -Anwendung in einem Docker -Container auf IIS zu hosten?C#

Ein Treffpunkt für C#-Programmierer
Anonymous
 Ist es möglich, eine .NET -Anwendung in einem Docker -Container auf IIS zu hosten?

Post by Anonymous »

Ich habe eine Anwendung mit .NET 8 und MySQL 8.0 im Docker -Container erstellt, und ich muss diesen Container auf IIS bereitstellen, damit jeder Benutzer über IP im lokalen Netzwerk darauf zugreifen kann. Meine Frage ist: Ist es möglich, dies nur durch Ausführen eines Containers dieser Anwendung mit einer bestimmten Dockerfile zu tun?

Code: Select all

FROM mcr.microsoft.com/dotnet/aspnet:8.0-windowsservercore-ltsc2019 AS base
WORKDIR /app
EXPOSE 8080
EXPOSE 8081

FROM mcr.microsoft.com/dotnet/sdk:8.0-windowsservercore-ltsc2019 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["HMS/HMS.csproj", "HMS/"]
COPY ["HMS.Infra.IoC/HMS.Infra.IoC.csproj", "HMS.Infra.IoC/"]
COPY ["HMS.Data/HMS.Data.csproj", "HMS.Data/"]
COPY ["HMS.Domain/HMS.Domain.csproj", "HMS.Domain/"]
RUN dotnet restore "./HMS/HMS.csproj"
COPY . .
WORKDIR "/src/HMS"
RUN dotnet build "./HMS.csproj" -c %BUILD_CONFIGURATION% -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./HMS.csproj" -c %BUILD_CONFIGURATION% -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "HMS.dll"]
< /code>
Mein Docker komponiert mit MySQL: < /p>
version: '3.9'

services:
mysql:
image: mysql:8.0
container_name: hms-mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: password of server
ports:
- "3306:3306"
networks:
hms-net:
aliases:
- localhost

hms:  #

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post