Docker
This commit is contained in:
@@ -1,21 +1,26 @@
|
|||||||
#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
|
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
EXPOSE 443
|
EXPOSE 443
|
||||||
|
|
||||||
|
# Image for building the project
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
||||||
WORKDIR /src
|
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 . .
|
COPY . .
|
||||||
WORKDIR "/src/Aberwyn"
|
|
||||||
RUN dotnet build "Aberwyn.csproj" -c Release -o /app/build
|
RUN dotnet build "Aberwyn.csproj" -c Release -o /app/build
|
||||||
|
|
||||||
|
# Publish the app to the /app/publish folder
|
||||||
FROM build AS publish
|
FROM build AS publish
|
||||||
RUN dotnet publish "Aberwyn.csproj" -c Release -o /app/publish
|
RUN dotnet publish "Aberwyn.csproj" -c Release -o /app/publish
|
||||||
|
|
||||||
|
# Use the base runtime image to run the app
|
||||||
FROM base AS final
|
FROM base AS final
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=publish /app/publish .
|
COPY --from=publish /app/publish .
|
||||||
|
|||||||
Reference in New Issue
Block a user