|
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 | | - |
11 | | -# Copy only the project files first to leverage Docker cache |
12 | 3 | COPY ShowcaseFrontend/ShowcaseFrontend.csproj ShowcaseFrontend/ |
13 | 4 | RUN dotnet restore ShowcaseFrontend/ShowcaseFrontend.csproj |
14 | | - |
15 | | -# Copy the rest of the source code |
16 | 5 | COPY ShowcaseFrontend/. ShowcaseFrontend/ |
17 | | - |
18 | 6 | WORKDIR /app/ShowcaseFrontend |
19 | | -CMD ["dotnet", "watch", "run", "--project", "/app/ShowcaseFrontend/ShowcaseFrontend.csproj", "--no-launch-profile", "--urls=http://0.0.0.0:80"] |
| 7 | +CMD ["dotnet", "watch", "run", "--no-launch-profile", "--urls", "http://0.0.0.0:80"] |
20 | 8 |
|
21 | | -# Build stage for production |
22 | 9 | FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build |
23 | 10 | 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 |
| 11 | +COPY ShowcaseFrontend/ShowcaseFrontend.csproj ShowcaseFrontend/ |
| 12 | +RUN dotnet restore ShowcaseFrontend/ShowcaseFrontend.csproj |
| 13 | +COPY ShowcaseFrontend/. ShowcaseFrontend/ |
| 14 | +WORKDIR /src/ShowcaseFrontend |
| 15 | +RUN dotnet publish -c Release -o /app/publish /p:UseAppHost=false |
33 | 16 |
|
34 | | -# Final production stage |
35 | | -FROM base AS final |
| 17 | +FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS final |
36 | 18 | WORKDIR /app |
37 | | -COPY --from=publish /app/publish . |
| 19 | +COPY --from=build /app/publish . |
38 | 20 | ENTRYPOINT ["dotnet", "ShowcaseFrontend.dll"] |
0 commit comments