Skip to content

Commit f7efeec

Browse files
committed
Ensures production build works without a lockfile
Allows fallback to npm install if a lockfile is missing, preventing CI or partial checkouts from failing.
1 parent a0c177a commit f7efeec

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

server/server/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ RUN npm run build
1010
FROM node:18-alpine
1111
WORKDIR /app
1212
# Install only production deps
13-
COPY package.json package-lock.json ./
14-
RUN npm ci --production
13+
COPY package.json ./
14+
# If a package-lock.json is present, npm ci will be used; if not, fall back
15+
# to npm install so the build doesn't fail when the lockfile is absent in the
16+
# build context (common when CI checkouts or subfolders don't include it).
17+
RUN npm ci --production || npm install --production
1518
COPY --from=build /app/dist ./dist
1619
EXPOSE 4000
1720
CMD ["node", "dist/index.js"]

0 commit comments

Comments
 (0)