fix(deploy): copy package.json into subdirs and run npm with --prefix to handle monorepo-like layout
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
FROM node:20-alpine AS builder
|
||||
WORKDIR /app
|
||||
COPY frontend/package*.json ./
|
||||
# Use npm ci when lockfile exists, fallback to npm install
|
||||
RUN sh -c 'if [ -f package-lock.json ] || [ -f npm-shrinkwrap.json ]; then npm ci; else npm install; fi'
|
||||
COPY frontend/ ./
|
||||
COPY frontend/package*.json frontend/
|
||||
# Use npm ci when lockfile exists in frontend, fallback to npm install
|
||||
RUN sh -c 'if [ -f frontend/package-lock.json ] || [ -f frontend/npm-shrinkwrap.json ]; then npm ci --prefix frontend; else npm install --prefix frontend; fi'
|
||||
COPY frontend/ frontend/
|
||||
RUN npm run build --prefix frontend
|
||||
|
||||
FROM nginx:stable-alpine
|
||||
|
Reference in New Issue
Block a user