FLEY
FLEY
PPrisma
Created by FLEY on 8/22/2024 in #help-and-questions
Prisma type generating doesn't work in Docker
Hi, I'm trying to build docker container for my node.js application but all the time it fails because when I try to build the application, it gives me errors saying that @prisma/client types are undefined. I'd be glad if someone helped me, I'm stuck with this. Dockerfile:
FROM node:18-alpine

RUN apk add --no-cache python3 make g++

ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"

WORKDIR /app

COPY package.json pnpm-lock.yaml ./

RUN corepack enable
RUN pnpm install
RUN pnpm install -g prisma

COPY prisma ./prisma/
COPY . .

RUN pnpm run gen

RUN pnpm run build

EXPOSE 8000

CMD ["sh", "-c", " pnpm run push && pnpm start"]
FROM node:18-alpine

RUN apk add --no-cache python3 make g++

ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"

WORKDIR /app

COPY package.json pnpm-lock.yaml ./

RUN corepack enable
RUN pnpm install
RUN pnpm install -g prisma

COPY prisma ./prisma/
COPY . .

RUN pnpm run gen

RUN pnpm run build

EXPOSE 8000

CMD ["sh", "-c", " pnpm run push && pnpm start"]
package.json scripts:
"scripts": {
"build": "tsc -p .",
"dev": "set NODE_ENV=development&& nodemon",
"staging": "set NODE_ENV=staging&& node dist/server.js",
"start": "set NODE_ENV=production&& node dist/server.js",
"lint": "eslint ./src/*.ts --fix && prettier --write ./src/*.ts",
"prepare": "husky",
"gen": "pnpm exec prisma generate",
"push": "pnpm exec prisma db push",
"migrate": "pnpm exec prisma migrate dev"
},
"prisma": {
"schema": "prisma"
},
"scripts": {
"build": "tsc -p .",
"dev": "set NODE_ENV=development&& nodemon",
"staging": "set NODE_ENV=staging&& node dist/server.js",
"start": "set NODE_ENV=production&& node dist/server.js",
"lint": "eslint ./src/*.ts --fix && prettier --write ./src/*.ts",
"prepare": "husky",
"gen": "pnpm exec prisma generate",
"push": "pnpm exec prisma db push",
"migrate": "pnpm exec prisma migrate dev"
},
"prisma": {
"schema": "prisma"
},
3 replies