Skip to content

Commit 71a4c6e

Browse files
Update Dockerfile in Frontend resolving package json
Signed-off-by: cogniware-devops <ambarish.desai@cogniware.ai>
1 parent f91c469 commit 71a4c6e

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

CogniwareIms/frontend/Dockerfile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,16 @@ RUN apk add --no-cache libc6-compat
77
WORKDIR /app
88

99
# Install dependencies (including dev dependencies for build)
10-
COPY frontend/package.json frontend/package-lock.json* ./
11-
RUN npm ci
10+
COPY frontend/package.json ./
11+
# Copy package-lock.json if it exists (wildcard makes it optional)
12+
COPY frontend/package-lock.json* ./
13+
# Use npm ci if lockfile exists and is valid, otherwise fall back to npm install
14+
RUN if [ -f package-lock.json ] && [ -s package-lock.json ]; then \
15+
npm ci --legacy-peer-deps || npm install; \
16+
else \
17+
echo "No valid package-lock.json found, using npm install"; \
18+
npm install; \
19+
fi
1220

1321
# Rebuild the source code only when needed
1422
FROM base AS builder

0 commit comments

Comments
 (0)