-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (31 loc) · 1.08 KB
/
Dockerfile
File metadata and controls
55 lines (31 loc) · 1.08 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Angular and C# .NET Core Web API
# This Dockerfile is used to build a multi-stage Docker image for an Angular frontend and a C# .NET Core Web API backend.
# Stage 1: Build the Angular app
# Build the Angular app
FROM node:24-alpine3.20 AS build-client
WORKDIR /app/client
COPY client/package*.json ./
# Install dependencies
RUN npm install --yes-cache
# Copy the rest of the application code
COPY client/. .
RUN npm run build --prod
# Stage 2: Build the Angular app for production
# Build the .NET Core Web API
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build-api
WORKDIR /app/api
# Copy the .NET Core Web API csproj file and restore dependencies
COPY api/*.csproj ./
RUN dotnet restore
COPY api/. .
# Build and publish a release
RUN dotnet publish -o out
# Stage 3: Build the final image
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS final
WORKDIR /app
# Copy the Angular build output to the final image
COPY --from=build-client /app/client/dist/zone-vitae/browser ./wwwroot
COPY --from=build-api /app/api/out ./
EXPOSE 80
ENTRYPOINT ["dotnet", "api.dll"]