26 lines
681 B
Docker
26 lines
681 B
Docker
# Stage 1: Build the frontend
|
|
FROM node:20-alpine AS frontend-build
|
|
WORKDIR /app
|
|
COPY ClientApp/package*.json ./
|
|
RUN npm ci
|
|
COPY ClientApp/ .
|
|
RUN npm run build
|
|
|
|
# Stage 2: Build the backend
|
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS backend-build
|
|
WORKDIR /src
|
|
COPY ["backend.csproj", "."]
|
|
RUN dotnet restore
|
|
COPY . .
|
|
# Copy the frontend build output from the previous stage
|
|
COPY --from=frontend-build /app/dist ./ClientApp/dist
|
|
RUN dotnet publish -c Release -o /app/publish
|
|
|
|
# Stage 3: Runtime
|
|
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
|
|
WORKDIR /app
|
|
EXPOSE 8080
|
|
ENV ASPNETCORE_URLS=http://+:8080
|
|
COPY --from=backend-build /app/publish .
|
|
ENTRYPOINT ["dotnet", "backend.dll"]
|