-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (29 loc) · 1.15 KB
/
Dockerfile
File metadata and controls
41 lines (29 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
39
40
41
# Use an official Node.js runtime as the base image for the client build
FROM --platform=linux/amd64 node:22-slim AS client-builder
# Set the working directory in the client builder container
WORKDIR /app/client
# Copy the client-side package.json and package-lock.json to the client builder container
COPY client/package*.json ./
# Install client application dependencies
RUN npm install
# Copy the client application source code to the client builder container
COPY client ./
# Build the client-side code
RUN npm run build
# Manually specify an amd64 arch build environment for the dotnet restore to complete
FROM mcr.microsoft.com/dotnet/sdk:9.0-alpine-amd64 AS build-env
WORKDIR /app/server
# Copy everything
COPY server/*.csproj ./
# Restore as distinct layers
RUN dotnet restore
COPY server ./
COPY --from=client-builder /app/client/dist /app/server/wwwroot
# Build and publish a release
RUN dotnet publish -c Release -o out
# If build fails here, check your /server folder for a *.sln file and delete it
# Start runtime image
FROM mcr.microsoft.com/dotnet/aspnet:9.0
WORKDIR /app
COPY --from=build-env /app/server/out .
ENTRYPOINT ["dotnet", "cat_api.dll"]