noteshare.space icon indicating copy to clipboard operation
noteshare.space copied to clipboard

[Bug] Docker image for backend won't build

Open Mikle-Bond opened this issue 11 months ago • 2 comments

Describe the bug

The docker outputs this error:

------
 > [build_image 6/8] RUN npx prisma generate:
#0 5.585 Prisma schema loaded from prisma/schema.prisma
#0 7.555 Error: Get Config: Unable to establish a connection to query-engine-node-api library.
#0 7.555 Details: Unable to require(`/app/node_modules/prisma/libquery_engine-linux-musl.so.node`)
#0 7.555  Error loading shared library libssl.so.1.1: No such file or directory (needed by /app/node_modules/prisma/libquery_engine-linux-musl.so.node)
#0 7.555
#0 7.555 Prisma CLI Version : 4.2.0
------
failed to solve: process "/bin/sh -c npx prisma generate" did not complete successfully: exit code: 1                                                                                                    

I found this issue to be helpful: https://github.com/prisma/prisma/issues/9624

I managed to build the image and spin up the project by changing BUILD_IMAGE to node:14.17.1-alpine, as suggested in one of the comments.

diff --git a/server/Dockerfile b/server/Dockerfile
index 34a14c0..80a753d 100644
--- a/server/Dockerfile
+++ b/server/Dockerfile
@@ -1,4 +1,4 @@
-FROM node:16-alpine AS BUILD_IMAGE
+FROM node:14.17.1-alpine AS BUILD_IMAGE
 
 
 # install dependencies
@@ -24,4 +24,4 @@ COPY --from=0 /app .
 ENV PORT 8080
 EXPOSE 8080
 
-CMD ["node", "./build/src/server.js"]
\ No newline at end of file
+CMD ["node", "./build/src/server.js"]

I find this strange, as that issue was marked as resolved back in 2021.

Environment (please complete the following information):

  • OS: VMware Photon OS 5.0
  • Docker 24.0.5 (docker version listing below)
Client:
 Version:           19.03.12
 API version:       1.40
 Go version:        go1.13.12
 Git commit:        0ed913b8-
 Built:             07/28/2020 16:36:03
 OS/Arch:           windows/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          24.0.5
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.7
  Git commit:       a61e2b4
  Built:            Fri Aug  4 19:22:45 2023
  OS/Arch:          linux/amd64
  Experimental:     true
 containerd:
  Version:          1.6.21
  GitCommit:        3dce8eb055cbb6872793272b4f20ed16117344f8
 crun:
  Version:          1.8
  GitCommit:        0356bf4aff9a133d655dc13b1d9ac9424706cac4
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Mikle-Bond avatar Sep 02 '23 13:09 Mikle-Bond

@Mikle-Bond thanks alot this save my day!

Marlon154 avatar Dec 04 '23 09:12 Marlon154