quizapp/FWLAZ_Web/Dockerfile

44 lines
1.6 KiB
Docker

ARG DOTNET_RUNTIME=mcr.microsoft.com/dotnet/aspnet:8.0
ARG DOTNET_SDK=mcr.microsoft.com/dotnet/sdk:8.0
# Unter https://aka.ms/customizecontainer erfahren Sie, wie Sie Ihren Debugcontainer anpassen und wie Visual Studio dieses Dockerfile verwendet, um Ihre Images für ein schnelleres Debuggen zu erstellen.
# Diese Stufe wird verwendet, wenn sie von VS im Schnellmodus ausgeführt wird (Standardeinstellung für Debugkonfiguration).
FROM ${DOTNET_RUNTIME} AS base
USER app
WORKDIR /app
ENV ASPNETCORE_URLS=http://+:8080
ENV ASPNETCORE_ENVIRONMENT=Development
EXPOSE 8080
EXPOSE 8081
# Diese Stufe wird zum Erstellen des Dienstprojekts verwendet.
FROM ${DOTNET_SDK} AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["FWLAZ_Web.csproj", "."]
RUN dotnet restore "./FWLAZ_Web.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "./FWLAZ_Web.csproj" -c $BUILD_CONFIGURATION -o /app/build
# Diese Stufe wird verwendet, um das Dienstprojekt zu veröffentlichen, das in die letzte Phase kopiert werden soll.
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./FWLAZ_Web.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
# Diese Stufe wird in der Produktion oder bei Ausführung von VS im regulären Modus verwendet (Standard, wenn die Debugkonfiguration nicht verwendet wird).
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
VOLUME /app/Data
USER root
ENTRYPOINT ["dotnet", "FWLAZ_Web.dll"]
# Invalid
#ARG USER_ID
#ARG GROUP_ID
#RUN addgroup --gid $GROUP_ID user
#RUN adduser --disabled-password --gecos '' --uid $USER_ID --gid $GROUP_ID user
#USER user