P
Prisma5mo ago
JTB

Prisma NextJs Docker and Multi Datasource

Hello, thanks for your time. I use Prisma, Docker and NextJs at work. A combination that is almost unbeatable. Now I have the following problem, I have several database connections. So I have the following structure: ./prisma ./prisma/tabelhub/schema.prisma -->
generator client {
provider = "prisma-client-js"
output = "./generated/tablehub"
binaryTargets = ["native", "linux-musl-openssl-3.0.x"]
}

datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
output = "./generated/tablehub"
binaryTargets = ["native", "linux-musl-openssl-3.0.x"]
}

datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
./prisma/camunda/schema.prisma -->
generator client {
provider = "prisma-client-js"
output = "./generated/camunda"
binaryTargets = ["native", "linux-musl-openssl-3.0.x"]
previewFeatures = ["views"]
}
datasource db {
provider = "mysql"
url = env("DATABASE2_URL")
}
generator client {
provider = "prisma-client-js"
output = "./generated/camunda"
binaryTargets = ["native", "linux-musl-openssl-3.0.x"]
previewFeatures = ["views"]
}
datasource db {
provider = "mysql"
url = env("DATABASE2_URL")
}
depending on the connection, I simply integrate the client. This also works with "npm run dev" and the build also starts. However, as soon as I go over to Docker, the second client is not "copied" and built? Generate the Prisma clients for both schemas
RUN npx prisma generate --schema=./prisma/camunda/schema.prisma && \
cp ./prisma/camunda/generated/camunda/ ./prisma/camunda/generated/camunda/

RUN npx prisma generate --schema=./prisma/tablehub/schema.prisma && \
cp ./prisma/camunda/generated/camunda/ ./prisma/tablehub/generated/tablehub/
RUN npx prisma generate --schema=./prisma/camunda/schema.prisma && \
cp ./prisma/camunda/generated/camunda/ ./prisma/camunda/generated/camunda/

RUN npx prisma generate --schema=./prisma/tablehub/schema.prisma && \
cp ./prisma/camunda/generated/camunda/ ./prisma/tablehub/generated/tablehub/
does anyone have an idea? Translated with DeepL.com (free version)
1 Reply
JTB
JTBOP5mo ago
Can be closed. The error was a typo in the Dockerfile, which meant that the client was not copied correctly.
Want results from more Discord servers?
Add your server