Same two bugs found deploying ceo-api: npm ci needs --include=dev in the build stage (Coolify exposes NODE_ENV=production at build time, which makes npm skip devDependencies otherwise), and tsconfig needs an explicit include filter to keep nest build's output at dist/main.js.
14 lines
351 B
Docker
14 lines
351 B
Docker
FROM node:22-alpine AS build
|
|
WORKDIR /app
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci --legacy-peer-deps --include=dev
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
FROM node:22-alpine
|
|
WORKDIR /app
|
|
ENV NODE_ENV=production
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci --legacy-peer-deps --omit=dev
|
|
COPY --from=build /app/dist ./dist
|
|
CMD ["node", "dist/main"]
|