Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 8 additions & 28 deletions ShowcaseProject/ShowcaseFrontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,38 +1,18 @@
# Base image with only runtime (for production)
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
WORKDIR /app
EXPOSE 8080
EXPOSE 8081

# Development stage with full .NET SDK for hot reload
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS dev
WORKDIR /app

# Copy only the project files first to leverage Docker cache
COPY ShowcaseFrontend/ShowcaseFrontend.csproj ShowcaseFrontend/
RUN dotnet restore ShowcaseFrontend/ShowcaseFrontend.csproj

# Copy the rest of the source code
COPY ShowcaseFrontend/. ShowcaseFrontend/

WORKDIR /app/ShowcaseFrontend
CMD ["dotnet", "watch", "run", "--project", "/app/ShowcaseFrontend/ShowcaseFrontend.csproj", "--no-launch-profile", "--urls=http://0.0.0.0:80"]
CMD ["dotnet", "watch", "run", "--no-launch-profile", "--urls", "http://+:80"]

# Build stage for production
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY ShowcaseProject/ShowcaseFrontend/ShowcaseFrontend.csproj ShowcaseFrontend/
RUN dotnet restore "./ShowcaseFrontend/ShowcaseFrontend.csproj"
COPY ShowcaseProject/ShowcaseFrontend/. ShowcaseFrontend/
WORKDIR "/src/ShowcaseFrontend"
RUN dotnet build "./ShowcaseFrontend.csproj" -c Release -o /app/build

# Publish stage
FROM build AS publish
RUN dotnet publish "./ShowcaseFrontend.csproj" -c Release -o /app/publish /p:UseAppHost=false
WORKDIR /src/ShowcaseFrontend
COPY ShowcaseFrontend/ShowcaseFrontend.csproj ./
RUN dotnet restore
COPY ShowcaseFrontend/. ./
RUN dotnet publish -c Release -o /app/publish /p:UseAppHost=false

# Final production stage
FROM base AS final
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS final
WORKDIR /app
COPY --from=publish /app/publish .
COPY --from=build /app/publish .
ENTRYPOINT ["dotnet", "ShowcaseFrontend.dll"]

This file was deleted.

Loading