rallly icon indicating copy to clipboard operation
rallly copied to clipboard

Building ARM64 docker image fails

Open QuantumQuacken opened this issue 6 months ago • 0 comments

Describe the bug I'm trying to build from source (tag v3.9.0, commit 879e57a) an image for arm64, but I encounter this error at the end of the Dockerfile:

docker build .
[+] Building 310.9s (25/27)                                                                       
 => [internal] load build definition from Dockerfile                                              
 => => transferring dockerfile: 1.57kB                                                            
 => [internal] load metadata for docker.io/library/node:20                                        
 => [internal] load .dockerignore                                                                 
 => => transferring context: 192B                                                                 
 => [runner  1/12] FROM docker.io/library/node:20@sha256:1ae9ba874435551280e95c8a8e74adf8a48d72b56
 => => resolve docker.io/library/node:20@sha256:1ae9ba874435551280e95c8a8e74adf8a48d72b564bf9dfe47
 => => sha256:a156154c8b862c981c6225ec24c3d0b4fed7831454b3f4aa2820b3da87d99496 2.50kB / 2.50kB    
 => => sha256:9c5ed83eaf5c33e6b2ceb5fe1b2b1300f9117a5dc5eae13b75f9f66dcce43a0f 49.59MB / 49.59MB  
 => => sha256:0df40ff8dff06855b2dff09ca815eb5044fdfb6861e4d23120e04f07ce113184 23.59MB / 23.59MB  
 => => sha256:4e903e4e709d192e5547602a5978c79692063228a98585f33fb02d343bc15719 63.99MB / 63.99MB  
 => => sha256:1ae9ba874435551280e95c8a8e74adf8a48d72b564bf9dfe4718231f2144c88f 6.41kB / 6.41kB    
 => => sha256:46f86b19bfddfe8c59cefc0e3cd92efb98f9cab9632465cc4c7be8d09a62b824 6.60kB / 6.60kB    
 => => sha256:adacb995432c92df6de0b5690abdd064e095988fac45631ba8fc0a0ffa9be5cc 202.62MB / 202.62MB
 => => sha256:3126901a018b3387d513b88f9df58093d2e4206bad3f57fcd4c77772d9de9ed0 3.32kB / 3.32kB    
 => => extracting sha256:9c5ed83eaf5c33e6b2ceb5fe1b2b1300f9117a5dc5eae13b75f9f66dcce43a0f         
 => => sha256:89ae61796dec27fbdb71e2ca7505a6b9d2993695251d79d10394031e97da28ef 48.03MB / 48.03MB  
 => => sha256:961a6016c24d62ba6763352fbeecb55499ff52a08e730c5745c69e5601d16072 1.25MB / 1.25MB    
 => => sha256:4208e7e6affaf5facbc66248924ae605612abd96f759117d707e39d5ad9ad28f 448B / 448B        
 => => extracting sha256:0df40ff8dff06855b2dff09ca815eb5044fdfb6861e4d23120e04f07ce113184         
 => => extracting sha256:4e903e4e709d192e5547602a5978c79692063228a98585f33fb02d343bc15719         
 => => extracting sha256:adacb995432c92df6de0b5690abdd064e095988fac45631ba8fc0a0ffa9be5cc         
 => => extracting sha256:3126901a018b3387d513b88f9df58093d2e4206bad3f57fcd4c77772d9de9ed0         
 => => extracting sha256:89ae61796dec27fbdb71e2ca7505a6b9d2993695251d79d10394031e97da28ef         
 => => extracting sha256:961a6016c24d62ba6763352fbeecb55499ff52a08e730c5745c69e5601d16072         
 => => extracting sha256:4208e7e6affaf5facbc66248924ae605612abd96f759117d707e39d5ad9ad28f         
 => [internal] load build context                                                                 
 => => transferring context: 19.60MB                                                              
 => [runner  2/12] WORKDIR /app                                                                   
 => [runner  3/12] RUN yarn global add prisma                                                     
 => [builder 3/5] RUN yarn global add turbo                                                       
 => [installer  3/10] COPY .gitignore .gitignore                                                  
 => [builder 4/5] COPY . .                                                                        
 => [builder 5/5] RUN turbo prune --scope=@rallly/web --docker                                    
 => [runner  4/12] RUN addgroup --system --gid 1001 nodejs                                        
 => [runner  5/12] RUN adduser --system --uid 1001 nextjs                                         
 => [installer  4/10] COPY --from=builder /app/out/json/ .                                        
 => [installer  5/10] COPY --from=builder /app/out/yarn.lock ./yarn.lock                          
 => [installer  6/10] RUN yarn --network-timeout 1000000                                          
 => [runner  6/12] COPY --from=builder --chown=nextjs:nodejs /app/scripts/docker-start.sh ./      
 => [runner  7/12] COPY --from=builder --chown=nextjs:nodejs /app/packages/database/prisma ./prism
 => [installer  7/10] COPY --from=builder /app/out/full/ .                                        
 => [installer  8/10] COPY turbo.json turbo.json                                                  
 => [installer  9/10] RUN yarn db:generate                                                        
 => [installer 10/10] RUN SKIP_ENV_VALIDATION=1 yarn build                                        
 => CANCELED [runner  8/12] COPY --from=installer /app/apps/web/next.config.js .                  
 => CACHED [runner  9/12] COPY --from=installer /app/apps/web/package.json .                      
 => ERROR [runner 10/12] COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/standalon
------
 > [runner 10/12] COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/standalone ./:
------
Dockerfile:50
--------------------
  48 |     # Automatically leverage output traces to reduce image size
  49 |     # https://nextjs.org/docs/advanced-features/output-file-tracing
  50 | >>> COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/standalone ./
  51 |     COPY --from=installer --chown=nextjs:nodejs /app/apps/web/.next/static ./apps/web/.next
  52 |     COPY --from=installer --chown=nextjs:nodejs /app/apps/web/public ./apps/web/public
--------------------
ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref 48ba38aa-43d8db021f5::pq4smk1d2c0yt6z89q3sqxo91: "/app/apps/web/.next/standalone": not **found**

If I try the same using the latest commit on main (7641cdf), I get an error on prisma generate that complains about the lack of the prisma.schema: 159.3 Error: Could not find Prisma Schema that is required for this command.. I checked the paths used by prisma to look for the schema and I can see it there, so it raises the question: in order to make the build work, I moved the Dockerfile from apps/web/ to the root directory of the cloned repo. Could that cause issues with the relative paths of the last COPY instructions in the Dockerfile? Where should I keep it in order to build the project? (In its original path, it lacks all the files that sit in the root of the repo).

[!NOTE] I'm building it directly on arm64, but I also tried building it on Windows 10 using docker buildx build --platform linux/arm64 . and got the same errors, which reinforces the argument that the Dockerfile's position I used is wrong.

On arm64:

  • OS: Debian GNU/Linux 12 (bookworm)
  • Docker: Docker version 27.1.1

On x86/64:

  • OS: Win10
  • Docker Desktop 4.33.1: Docker version 27.1.1

Any suggestions are appreciated. Thank you!

QuantumQuacken avatar Aug 06 '24 20:08 QuantumQuacken