|
1 | | -# Base image with only runtime (for production) |
2 | | -FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base |
3 | | -WORKDIR /app |
4 | | -EXPOSE 8080 |
5 | | -EXPOSE 8081 |
6 | | - |
7 | | -# Development stage with full .NET SDK for hot reload |
8 | 1 | FROM mcr.microsoft.com/dotnet/sdk:8.0 AS dev |
9 | 2 | WORKDIR /app |
10 | 3 |
|
11 | | -# Copy only the project files first to leverage Docker cache |
12 | | -COPY ShowcaseFrontend/ShowcaseFrontend.csproj ShowcaseFrontend/ |
13 | | -RUN dotnet restore ShowcaseFrontend/ShowcaseFrontend.csproj |
14 | | - |
15 | | -# Copy the rest of the source code |
16 | 4 | COPY ShowcaseFrontend/. ShowcaseFrontend/ |
17 | | - |
18 | 5 | WORKDIR /app/ShowcaseFrontend |
19 | | -CMD ["dotnet", "watch", "run", "--project", "/app/ShowcaseFrontend/ShowcaseFrontend.csproj", "--no-launch-profile", "--urls=http://0.0.0.0:80"] |
| 6 | +CMD ["dotnet", "watch", "run", "--no-launch-profile", "--urls", "http://+:80"] |
20 | 7 |
|
21 | | -# Build stage for production |
22 | 8 | FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build |
23 | | -WORKDIR /src |
24 | | -COPY ShowcaseProject/ShowcaseFrontend/ShowcaseFrontend.csproj ShowcaseFrontend/ |
25 | | -RUN dotnet restore "./ShowcaseFrontend/ShowcaseFrontend.csproj" |
26 | | -COPY ShowcaseProject/ShowcaseFrontend/. ShowcaseFrontend/ |
27 | | -WORKDIR "/src/ShowcaseFrontend" |
28 | | -RUN dotnet build "./ShowcaseFrontend.csproj" -c Release -o /app/build |
29 | | - |
30 | | -# Publish stage |
31 | | -FROM build AS publish |
32 | | -RUN dotnet publish "./ShowcaseFrontend.csproj" -c Release -o /app/publish /p:UseAppHost=false |
| 9 | +WORKDIR /src/ShowcaseFrontend |
| 10 | +COPY ShowcaseFrontend/ShowcaseFrontend.csproj ./ |
| 11 | +RUN dotnet restore |
| 12 | +COPY ShowcaseFrontend/. ./ |
| 13 | +RUN dotnet publish -c Release -o /app/publish /p:UseAppHost=false |
33 | 14 |
|
34 | | -# Final production stage |
35 | | -FROM base AS final |
| 15 | +FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS final |
36 | 16 | WORKDIR /app |
37 | | -COPY --from=publish /app/publish . |
| 17 | +COPY --from=build /app/publish . |
38 | 18 | ENTRYPOINT ["dotnet", "ShowcaseFrontend.dll"] |
0 commit comments