Skip to content

Commit 84c77e3

Browse files
committed
A
1 parent 02297c3 commit 84c77e3

File tree

1 file changed

+8
-28
lines changed

1 file changed

+8
-28
lines changed
Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,18 @@
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
81
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS dev
92
WORKDIR /app
103

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
164
COPY ShowcaseFrontend/. ShowcaseFrontend/
17-
185
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"]
207

21-
# Build stage for production
228
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
3314

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

0 commit comments

Comments
 (0)