fix building frontend

This commit is contained in:
2026-09-03 09:23:50 +03:30
parent 2aca48738f
commit ece4b17edf
2 changed files with 11 additions and 14 deletions

View File

@@ -1,14 +1,19 @@
# Stage 1: Build frontend
FROM node:20-alpine AS frontend-build
WORKDIR /app
COPY ./src/GreenHome.Web/package*.json ./
RUN npm ci --ignore-scripts || npm install
COPY ./src/GreenHome.Web/ .
RUN npm run build
# Stage 2: Build backend
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
WORKDIR /src
# Install Node.js and build tools for native modules
RUN apt-get update && apt-get install -y nodejs npm python3 make g++ && rm -rf /var/lib/apt/lists/*
COPY ./src/ .
# Use npm ci for clean install based on package-lock.json
RUN cd ./GreenHome.Web && \
npm ci
# Copy built frontend from previous stage
COPY --from=frontend-build /app/dist /src/GreenHome.Api/wwwroot/
RUN dotnet restore --verbosity detailed
RUN dotnet publish -c Release -o /app