26 lines
677 B
Docker
26 lines
677 B
Docker
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
|
WORKDIR /src
|
|
|
|
# Copy csproj and restore dependencies
|
|
COPY ["SessionZero.sln", "./"]
|
|
COPY ["SessionZero/SessionZero.csproj", "SessionZero/"]
|
|
RUN dotnet restore
|
|
|
|
# Copy the rest of the files and build
|
|
COPY . .
|
|
RUN dotnet build "SessionZero/SessionZero.csproj" -c Release -o /app/build
|
|
|
|
# Publish the application
|
|
RUN dotnet publish "SessionZero/SessionZero.csproj" -c Release -o /app/publish
|
|
|
|
# Use the official ASP.NET Core runtime image
|
|
FROM nginx:alpine AS final
|
|
WORKDIR /usr/share/nginx/html
|
|
COPY --from=build /app/publish/wwwroot .
|
|
COPY nginx.conf /etc/nginx/nginx.conf
|
|
|
|
EXPOSE 80
|
|
EXPOSE 443
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|