I'm trying to build a Docker image with a NestJS +...
# orm-help
m
I'm trying to build a Docker image with a NestJS + Prisma application. I just switched from Windows to Mac Monterey OS (on M1 Pro) yesterday. I could build the image on my Windows machine, but now I can't build it on my Mac. Here's the error I'm receiving.
Copy code
Error: Unknown binaryTarget linux-arm64-openssl-undefined and no custom engine files were provided
When I searched that on Google, the first hit was specifically about Prisma: https://github.com/prisma/prisma/issues/861 And that one led me to a pretty detailed conversation https://github.com/prisma/prisma/issues/5245 The conversation says near the end, in July 2021:
"This will be available for eveyrone with 2.27.0".
I'm on v
3.15.1
My base image is
node:16.15.1-alpine
. Anyone have any advice or point me toward further discussion? Alternatively, would it be worth trying to update the binary targets in the Prisma config manually? Actually - should I specify the binary target for the eventual target - which will be a Cloud Run instance? My generator client:
Copy code
generator client {
  provider      = "prisma-client-js"
  binaryTargets = ["native", "linux-musl"]
}
j
What have you specified in your binaryTargets in your schema.prisma?
for alpine you'll need to list
linux-musl
in your binary targets
m
Thanks for the reply.
Copy code
generator client {
  provider      = "prisma-client-js"
  binaryTargets = ["native", "linux-musl"]
}
So I guess maybe the linux-musl needs to be there for the target (the Docker image), but "native" hsould be covering the other
... actually, it says "linux-arm-open-ssl-undefined" in my error message. This must be it. Just gotta figure out which one my processor is.
helpful link - thanks Jared.
Ah. My openSSL version is 2.8.3. Maybe I'm screwed.
j
yeah its like prisma can't detect what openssl version you have hence the undefined. might need to open an issue
i'm not familiar with Cloud Run sorry
m
I think it's actually my local machine that's having the problem - somehow. I was able to create images on my Windows machine (which now has an unrecoverable BIOS). I can run
npx prisma generate
and run a local server. I don't think this has anything to do with Cloud Run yet - I'm just trying to locally build a container right now.
As an update - Cloud Build can build the image with just ""native" in the generator.
j
we have a few different types of dev envs, and deploy to alpine docker container. our targets look like
binaryTargets   = ["native", "linux-musl", "debian-openssl-1.1.x", "darwin-arm64", "darwin"]
this includes m1 macs
i believe
darwin-arm64
is the m1 mac equivilent
z
I had same problem, fix it by change
node:16-alpine
to
node:lts
and
Copy code
RUN apk update && apk add dumb-init
to
Copy code
RUN apt-get -qy update && apt-get -qy install openssl && apt-get -qy install dumb-init
in docker file