fix building frontend
This commit is contained in:
17
Dockerfile
17
Dockerfile
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user