This commit is contained in:
Elias Jansson
2024-10-20 21:47:19 +02:00
parent ff90b86fd2
commit 36429beada

View File

@@ -1,22 +1,27 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
# Base image for runtime
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
# Image for building the project
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["Aberwyn/Aberwyn.csproj", "Aberwyn/"]
RUN dotnet restore "Aberwyn/Aberwyn.csproj"
# Copy the .csproj and restore dependencies
COPY ["Aberwyn.csproj", "./"]
RUN dotnet restore "Aberwyn.csproj"
# Copy everything else and build the app
COPY . .
WORKDIR "/src/Aberwyn"
RUN dotnet build "Aberwyn.csproj" -c Release -o /app/build
# Publish the app to the /app/publish folder
FROM build AS publish
RUN dotnet publish "Aberwyn.csproj" -c Release -o /app/publish
# Use the base runtime image to run the app
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Aberwyn.dll"]
ENTRYPOINT ["dotnet", "Aberwyn.dll"]