diff --git a/Dockerfile b/Dockerfile index 160a555..f555583 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,25 @@ FROM node:20-alpine AS builder WORKDIR /app + COPY package.json package-lock.json* ./ COPY packages/shared/package.json ./packages/shared/ COPY packages/db/package.json ./packages/db/ RUN npm install --ignore-scripts && npm rebuild bcrypt + COPY packages/shared/ ./packages/shared/ COPY packages/db/ ./packages/db/ -COPY . . -RUN cd packages/shared && npx tsc --module commonjs --moduleResolution node --outDir dist --declaration +COPY nest-cli.json ./ +COPY tsconfig.json ./ +COPY src/ ./src/ + +RUN cd packages/shared && npx tsc --outDir dist --declaration RUN cd packages/db && npx prisma generate RUN npx nest build FROM node:20-alpine AS runner WORKDIR /app RUN apk add --no-cache dumb-init + COPY --from=builder /app/node_modules ./node_modules COPY --from=builder /app/dist ./dist COPY --from=builder /app/packages/shared/dist ./packages/shared/dist @@ -22,6 +28,7 @@ RUN node -e "const p=require('./packages/shared/package.json');p.main='./dist/in COPY --from=builder /app/packages/db/prisma ./packages/db/prisma COPY --from=builder /app/packages/db/package.json ./packages/db/ COPY --from=builder /app/packages/db/src ./packages/db/src + ENV NODE_ENV=production EXPOSE 3001 ENTRYPOINT ["dumb-init", "--"] diff --git a/packages/shared/tsconfig.json b/packages/shared/tsconfig.json index 792172f..dae4070 100644 --- a/packages/shared/tsconfig.json +++ b/packages/shared/tsconfig.json @@ -1,8 +1,20 @@ { - "extends": "../../tsconfig.base.json", "compilerOptions": { + "target": "ES2022", + "module": "ESNext", + "moduleResolution": "bundler", + "lib": ["ES2022"], + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true, + "isolatedModules": true, + "declaration": true, + "sourceMap": true, "outDir": "./dist", "rootDir": "./src" }, - "include": ["src"] + "include": ["src"], + "exclude": ["node_modules", "dist"] }