fix(deploy): fallback to npm install when lockfile missing in Dockerfiles
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
FROM node:20-alpine AS builder
|
||||
WORKDIR /app
|
||||
COPY backend/package*.json ./
|
||||
RUN npm ci --production
|
||||
# Use npm ci if a lockfile exists, otherwise fall back to npm install
|
||||
RUN sh -c 'if [ -f package-lock.json ] || [ -f npm-shrinkwrap.json ]; then npm ci --production; else npm install --production; fi'
|
||||
COPY backend/ ./
|
||||
RUN npm run build --prefix backend
|
||||
|
||||
|
@@ -1,7 +1,8 @@
|
||||
FROM node:20-alpine AS builder
|
||||
WORKDIR /app
|
||||
COPY frontend/package*.json ./
|
||||
RUN npm ci
|
||||
# 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/ ./
|
||||
RUN npm run build --prefix frontend
|
||||
|
||||
|
Reference in New Issue
Block a user