Fix: Add .npmrc config and improve npm install robustness
This commit is contained in:
5
.npmrc
Normal file
5
.npmrc
Normal file
@@ -0,0 +1,5 @@
|
||||
legacy-peer-deps=true
|
||||
audit=false
|
||||
fund=false
|
||||
progress=false
|
||||
omit=dev
|
||||
12
Dockerfile
12
Dockerfile
@@ -2,13 +2,17 @@ FROM node:18-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy npm config first
|
||||
COPY .npmrc ./
|
||||
|
||||
# Copy package files
|
||||
COPY backend/package*.json ./
|
||||
|
||||
# Install dependencies - bypass npm bugs
|
||||
RUN npm ci --omit=dev || npm install --omit=dev || true && \
|
||||
npm install --save express express-session bcryptjs dotenv cors multer fs-extra && \
|
||||
if [ ! -d node_modules/express ]; then echo "ERROR: express not installed" && exit 1; fi
|
||||
# Install dependencies with retry logic
|
||||
RUN npm cache clean --force && \
|
||||
npm install --no-optional --legacy-peer-deps 2>&1 | tail -20 && \
|
||||
ls -la node_modules/express || npm install express && \
|
||||
test -d node_modules/express || (echo "FATAL: express not found" && exit 1)
|
||||
|
||||
# Copy application code
|
||||
COPY backend/src ./src
|
||||
|
||||
Reference in New Issue
Block a user