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