mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-01 18:57:24 +00:00
57 lines
2.1 KiB
Docker
57 lines
2.1 KiB
Docker
# This stage is used when running from VS in fast mode (Default for Debug configuration).
|
|
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
|
|
# Curl is used by the container healthcheck to probe the /health endpoints.
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends curl \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& mkdir /logs && chown -R app:app /logs
|
|
USER app
|
|
WORKDIR /app
|
|
EXPOSE 5012
|
|
|
|
|
|
# ==== Stage 1: Build stage
|
|
FROM mcr.microsoft.com/dotnet/sdk:10.0.100 AS build
|
|
|
|
ARG BUILD_CONFIGURATION=Release
|
|
|
|
WORKDIR /src
|
|
|
|
# Restore NuGet packages (keeping this section separate from the rest of the project files allows Docker to cache the restored packages).
|
|
COPY ["Directory.Build.props", "."]
|
|
COPY ["Directory.Packages.props", "."]
|
|
COPY ["global.json", "."]
|
|
COPY ["src/AssemblyInfo_Shared.cs", "src/"]
|
|
COPY ["src/Directory.Build.props", "src/"]
|
|
COPY ["src/Nemera.Presentation.Web/Nemera.Presentation.Web.csproj", "src/Nemera.Presentation.Web/"]
|
|
|
|
RUN dotnet restore "./src/Nemera.Presentation.Web/Nemera.Presentation.Web.csproj" /p:BaseOutputPath=/app/publish/
|
|
|
|
# Build the project.
|
|
COPY ["src/", "src/"]
|
|
WORKDIR /src/src/Nemera.Presentation.Web
|
|
|
|
RUN dotnet build "./Nemera.Presentation.Web.csproj" -c $BUILD_CONFIGURATION -o /app/build /p:BaseOutputPath=/app/publish/
|
|
|
|
# ==== Stage 2: Publish stage
|
|
FROM build AS publish
|
|
|
|
ARG BUILD_CONFIGURATION=Release
|
|
|
|
RUN dotnet publish "./Nemera.Presentation.Web.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false /p:BaseOutputPath=/app/publish/
|
|
|
|
# ==== Stage 3: Run stage
|
|
#FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime
|
|
FROM base AS final
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=publish --chown=app:app /app/publish .
|
|
# The container branch in Program.cs binds the web client to this port. Direct published runs default to the documented
|
|
# address and can override it with ASPNETCORE_URLS, ASPNETCORE_HTTP_PORTS or ASPNETCORE_HTTPS_PORTS.
|
|
EXPOSE 5012
|
|
ENTRYPOINT ["dotnet", "Nemera.Presentation.Web.dll"]
|
|
|
|
# To build this Docker image, run the following command from the root of the project (location of the .slnx solution file):
|
|
# docker build --no-cache -t nemera-web -f src/Nemera.Presentation.Web/Dockerfile .
|