fix: standalone tsconfig and Dockerfile for monorepo split
This commit is contained in:
11
Dockerfile
11
Dockerfile
@@ -1,15 +1,20 @@
|
||||
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/
|
||||
COPY packages/admin-db/package.json ./packages/admin-db/
|
||||
RUN npm install
|
||||
|
||||
COPY packages/shared/ ./packages/shared/
|
||||
COPY packages/db/ ./packages/db/
|
||||
COPY packages/admin-db/ ./packages/admin-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/admin-db && DATABASE_ADMIN_URL="postgresql://placeholder" npx prisma generate
|
||||
RUN cd packages/db && DATABASE_URL="postgresql://placeholder" npx prisma generate
|
||||
RUN npx nest build
|
||||
@@ -17,6 +22,7 @@ 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/packages/admin-db/generated ./packages/admin-db/generated
|
||||
COPY --from=builder /app/packages/admin-db/prisma ./packages/admin-db/prisma
|
||||
@@ -27,6 +33,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/dist ./dist
|
||||
|
||||
ENV NODE_ENV=production
|
||||
EXPOSE 3004
|
||||
ENTRYPOINT ["dumb-init", "--"]
|
||||
|
||||
@@ -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"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user