-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (30 loc) · 1.15 KB
/
Copy pathDockerfile
File metadata and controls
38 lines (30 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# 1. Build the Angular Frontend
FROM node:20-alpine AS build-frontend
WORKDIR /app/frontend
# Copy the angular project (change 'client/' if your frontend folder has a different name)
COPY ["ClientApp/", "./"]
RUN npm install
# Build the app. Angular 17+ creates a 'browser' folder inside the dist output
RUN npm run build
# 2. Build the .NET Backend
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build-backend
WORKDIR /app
# Copy the solution and project files
COPY ["NetStore.sln", "./"]
COPY ["API/API.csproj", "API/"]
COPY ["Core/Core.csproj", "Core/"]
COPY ["Infrastructure/Infrastructure.csproj", "Infrastructure/"]
RUN dotnet restore "NetStore.sln"
# Copy the rest of the backend code
COPY . .
WORKDIR "/app/API"
RUN dotnet publish "API.csproj" -c Release -o /app/out
# 3. Final Runtime Image (Combine Both)
FROM mcr.microsoft.com/dotnet/aspnet:10.0
WORKDIR /app
COPY --from=build-backend /app/out .
# Magic Step: Copy the Angular build from Stage 1 into the .NET wwwroot folder
# *NOTE: adjust 'client' below if your angular app folder is named differently*
COPY --from=build-frontend /app/API/wwwroot/browser ./wwwroot
EXPOSE 8080
ENTRYPOINT ["dotnet", "API.dll"]