docker icon indicating copy to clipboard operation
docker copied to clipboard

docker compose build failed with errors

Open curiousgeorgios opened this issue 10 months ago • 16 comments

Just trying to build the image so I can restore using a previous database snapshot but I can't build it for the life of me... have read all the other issue and tried building on multiple machines without any luck. I've tried building with 32GB of RAM so I know that's not an issue either. Would appreciate any help at all. Using latest version of docker repo and calcom submodule.

65.23 ➤ YN0013: │ zod@npm:3.22.4 can't be found in the cache and will be fetched from the remote registry
65.31 ➤ YN0013: │ zip-stream@npm:4.1.1 can't be found in the cache and will be fetched from the remote registry
65.31 ➤ YN0013: │ zod-error@npm:1.5.0 can't be found in the cache and will be fetched from the remote registry
65.31 ➤ YN0013: │ zod-prisma@npm:0.5.4 can't be found in the cache and will be fetched from the remote registry
65.31 ➤ YN0013: │ zod@npm:3.22.4 can't be found in the cache and will be fetched from the remote registry
65.31 ➤ YN0013: │ zustand@npm:4.5.2 can't be found in the cache and will be fetched from the remote registry
83.42 ➤ YN0066: │ typescript@patch:typescript@npm%3A5.4.2#~builtin<compat/typescript>::version=5.4.2&hash=1f5320: Cannot apply hunk #1
88.57 ➤ YN0066: │ typescript@patch:typescript@npm%3A5.3.3#~builtin<compat/typescript>::version=5.3.3&hash=1f5320: Cannot apply hunk #1
106.7 ➤ YN0000: └ Completed in 1m 41s
106.9 ➤ YN0000: ┌ Link step
141.3 ➤ YN0007: │ dotenv-checker@npm:1.1.5 must be built because it never has been before or the last one failed
141.3 ➤ YN0007: │ turbo@npm:1.10.1 must be built because it never has been before or the last one failed
141.3 ➤ YN0007: │ @prisma/engines@npm:5.11.0 must be built because it never has been before or the last one failed
141.3 ➤ YN0007: │ esbuild@npm:0.19.8 must be built because it never has been before or the last one failed
141.3 ➤ YN0007: │ msw@npm:0.42.3 [6d903] must be built because it never has been before or the last one failed
141.3 ➤ YN0007: │ @prisma/engines@npm:5.3.1 must be built because it never has been before or the last one failed
141.3 ➤ YN0007: │ @prisma/engines@npm:5.4.2 must be built because it never has been before or the last one failed
141.3 ➤ YN0007: │ esbuild@npm:0.18.20 must be built because it never has been before or the last one failed
141.3 ➤ YN0007: │ yarn@npm:1.22.19 must be built because it never has been before or the last one failed
141.3 ➤ YN0007: │ @prisma/engines@npm:5.1.1 must be built because it never has been before or the last one failed
141.3 ➤ YN0007: │ core-js@npm:3.21.1 must be built because it never has been before or the last one failed
141.3 ➤ YN0007: │ @sentry/cli@npm:1.75.2 must be built because it never has been before or the last one failed
141.3 ➤ YN0007: │ core-js-pure@npm:3.32.1 must be built because it never has been before or the last one failed
141.3 ➤ YN0007: │ protobufjs@npm:7.2.6 must be built because it never has been before or the last one failed
154.9 ➤ YN0007: │ calcom-monorepo@workspace:. must be built because it never has been before or the last one failed
154.9 ➤ YN0007: │ prisma@npm:5.11.0 must be built because it never has been before or the last one failed
154.9 ➤ YN0007: │ prisma@npm:5.4.2 must be built because it never has been before or the last one failed
160.0 ➤ YN0009: │ calcom-monorepo@workspace:. couldn't be built successfully (exit code 1, logs can be found here: /tmp/xfs-24c68e1c/build.log)
160.0 ➤ YN0007: │ @prisma/client@npm:5.4.2 [5d0b5] must be built because it never has been before or the last one failed
160.0 ➤ YN0007: │ @prisma/client@npm:5.4.2 [a80c8] must be built because it never has been before or the last one failed
161.2 ➤ YN0000: └ Completed in 54s 302ms
161.5 ➤ YN0000: Failed with errors in 2m 36s
------
failed to solve: process "/bin/sh -c yarn config set httpTimeout 1200000 &&     npx turbo prune --scope=@calcom/web --docker &&     yarn install" did not complete successfully: exit code: 1

curiousgeorgios avatar Mar 28 '24 06:03 curiousgeorgios

The Build and push image to DockerHub action in this repository also fails. Looks like this build was the last one, which succeeded.

kevinkupski avatar Mar 28 '24 08:03 kevinkupski

I'm getting the same problem. I could build perfectly fine a few weeks ago, but after updating the calcom submodule it fails to build with no error log/stacktrace which makes troubleshooting extremely difficult.

jabelone avatar Apr 02 '24 01:04 jabelone

cc @krumware or @alishaz-polymath, something is up with the yarn build and/or the yarn lock?

repeated errors about must be built because it never has been before or the last one failed and then ultimately the yarn build command fails. dockerfile can not be built.

eleith avatar Apr 03 '24 03:04 eleith

Yeah, we're looking into it. Thank you for the shout! 🙏

alishaz-polymath avatar Apr 03 '24 09:04 alishaz-polymath

Hi all,

I looked into this and found that some file(s) must be missing inside the container.

Copying all files (COPY ./calcom/. /calcom) into the container and running yarn install works.

Also, there's a new environment variable required during the build phase: https://github.com/calcom/cal.com/issues/14310#issuecomment-2035185749

krakowski avatar Apr 11 '24 08:04 krakowski

you can replace this line in Dockerfile to

COPY calcom/apps ./apps

and then add the v2 URL as from the .env.example into your own .env and also your build env as well

eleith avatar Apr 12 '24 05:04 eleith

Can confirm adding V2_URL did result in a successful build.

Here's what I did (which is just a more explicit edit described by @eleith):

  • Make the following changes in the Dockerfile
    • copy the api folder since it seems to be added in 3 weeks ago
    • introduce the new env variable NEXT_PUBLIC_API_V2_URL since it is called at 2 locations in the sub-module (turbo.json and next.config.js)
      COPY calcom/.yarn ./.yarn
    + COPY calcom/apps/api ./apps/api
      COPY calcom/apps/web ./apps/web 
    
        yarn --cwd packages/prisma seed-app-store
    
    + ARG NEXT_PUBLIC_API_V2_URL=http://localhost:5555/api/v2
    + ENV NEXT_PUBLIC_API_V2_URL=$NEXT_PUBLIC_API_V2_URL
    
      RUN yarn turbo run build --filter=@calcom/web 
    
  • Also introduce the variable into the docker-compose.yml in the environment section (I did this only for good measure, but I do not think this is required)

With this I am able to build v3.9.4 locally, as well deploy locally (meaning I am able to login and view my availability, I have not tested out anything else).

What is unclear to me are

  • what exactly uses or calls this v2 API and so whether it needs to be actually built and also if this api folder needs to be copied into builder-two ? Because I do not see any error messages in the browser console when running the app locally
  • whether this IP and port needs to be publicly exposed (calcom uses 5555). Again I don't see any error message when opening the homepage or the profile page, but it is puzzling that it is necessary to complete the build

@alishaz-polymath Maybe this helps you to narrow down the issue cause, or could shed more light on APIv2?

mtc-20 avatar Apr 12 '24 14:04 mtc-20

Hi, @mtc-20. Thanks to your message I managed to go further in the build process, but it still stops at a step almost at the end, the same one reported by another user. https://github.com/calcom/docker/issues/349 Any ideas?

intersecato avatar Apr 15 '24 10:04 intersecato

Hi @intersecato what version of calcom are you trying to build?

I tried running the build again for ~~v3.8.4~~ v3.9.4 (since that is what I have locally, and I did not want to update the submodule till there was an upstream fix here), making sure I had no other changes locally other than the two I specified in my above comment, and I am not able to reproduce the error.

mtc-20 avatar Apr 15 '24 12:04 mtc-20

Now it make sense @mtc-20, I'm trying to build the v4.0.0. Now I don't even know if I can start an older version because it's even past the point where it applies database migrations..

intersecato avatar Apr 15 '24 12:04 intersecato

@intersecato Sorry for the late reply. First of all, I noticed a typo in my earlier message, I tested locally on v3.9.4, not v3.8.4. And after your reply, I also tested locally for v4.0.0 and I am unable to reproduce the build errors mentioned in #349. It builds successfully.

Out of curiosity, are you building on hardware with RAM>=16GB, or lower?

mtc-20 avatar Apr 17 '24 11:04 mtc-20

@mtc-20 lower, we have 8GB on our web server vps.

intersecato avatar Apr 17 '24 11:04 intersecato

@intersecato do you have a spare VM/machine with atleast 16GB to try building on?

I had to switch to a 16GB VM from ~v3.7.12 onwards for production, because the builds kept failing with a similar error message. But I cannot guarantee this was the root cause of the build error.

mtc-20 avatar Apr 17 '24 12:04 mtc-20

I want to +1 this and say that for me a machine with 8GB was not enough and it failed with weird errors in all kinds of places.

asm0dey avatar Apr 17 '24 12:04 asm0dey

Can confirm adding V2_URL did result in a successful build.

Here's what I did (which is just a more explicit edit described by @eleith):

  • Make the following changes in the Dockerfile

    • copy the api folder since it seems to be added in 3 weeks ago
    • introduce the new env variable NEXT_PUBLIC_API_V2_URL since it is called at 2 locations in the sub-module (turbo.json and next.config.js)
      COPY calcom/.yarn ./.yarn
    + COPY calcom/apps/api ./apps/api
      COPY calcom/apps/web ./apps/web 
    
        yarn --cwd packages/prisma seed-app-store
    
    + ARG NEXT_PUBLIC_API_V2_URL=http://localhost:5555/api/v2
    + ENV NEXT_PUBLIC_API_V2_URL=$NEXT_PUBLIC_API_V2_URL
    
      RUN yarn turbo run build --filter=@calcom/web 
    
  • Also introduce the variable into the docker-compose.yml in the environment section (I did this only for good measure, but I do not think this is required)

With this I am able to build v3.9.4 locally, as well deploy locally (meaning I am able to login and view my availability, I have not tested out anything else).

What is unclear to me are

  • what exactly uses or calls this v2 API and so whether it needs to be actually built and also if this api folder needs to be copied into builder-two ? Because I do not see any error messages in the browser console when running the app locally
  • whether this IP and port needs to be publicly exposed (calcom uses 5555). Again I don't see any error message when opening the homepage or the profile page, but it is puzzling that it is necessary to complete the build

@alishaz-polymath Maybe this helps you to narrow down the issue cause, or could shed more light on APIv2?

Many thanks, worked for me with 4.0.1

TomKremer avatar Apr 19 '24 17:04 TomKremer

I am having the same issue again. I followed all the solutions suggested poreviously here but it keeps failing. This started suddenly. Not sure what changed. Can it be due to some memory or storage issue?

SanjuMLGeek avatar Sep 13 '24 18:09 SanjuMLGeek