calcom / docker

The Docker configuration for Cal.com is an effort powered by people within the community. Cal.com, Inc. does not provide official support for Docker, but we will accept fixes and documentation. Use at your own risk.
MIT License
662 stars 344 forks source link

Build failed #223

Closed Septa2112 closed 1 year ago

Septa2112 commented 1 year ago

Hi, I follow the steps of advanced user in readme, but build failed when I execute docker-compose up -d to build cal.com.

@calcom/embed-react:build: transforming...
@calcom/embed-react:build: ✓ 13 modules transformed.
@calcom/embed-react:build: rendering chunks...
@calcom/embed-react:build: computing gzip size...
@calcom/embed-react:build: dist/Cal.es.js  22.91 kB │ gzip: 7.05 kB
@calcom/embed-react:build: dist/Cal.umd.js  15.05 kB │ gzip: 6.04 kB
@calcom/web:build: cache miss, executing f12ab80b3e77f773
@calcom/web:build: $ next build
@calcom/web:build: warn  EMAIL_FROM environment variable is not set, this may indicate mailing is currently disabled. Please refer to the .env.example file.
@calcom/web:build: Attention: Next.js now collects completely anonymous telemetry regarding usage.
@calcom/web:build: This information is used to shape Next.js' roadmap and prioritize features.
@calcom/web:build: You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
@calcom/web:build: https://nextjs.org/telemetry
@calcom/web:build: 
@calcom/web:build: info  - Linting and checking validity of types...
@calcom/web:build: info  - Creating an optimized production build...
@calcom/web:build: <w> [webpack.cache.PackFileCacheStrategy] Serializing big strings (177kiB) impacts deserialization performance (consider using Buffer instead and decode when needed)
@calcom/web:build: Failed to compile.
@calcom/web:build: 
@calcom/web:build: pages/_app.tsx
@calcom/web:build: `next/font` error:
@calcom/web:build: Failed to fetch `Inter` from Google Fonts.
@calcom/web:build: 
@calcom/web:build: 
@calcom/web:build: > Build failed because of webpack errors
@calcom/web:build: error Command failed with exit code 1.
@calcom/web:build: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@calcom/web:build: ERROR: command finished with error: command (apps/web) yarn run build exited (1)

 Tasks:    7 successful, 8 total
Cached:    0 cached, 8 total
  Time:    3m29.123s 

command (apps/web) yarn run build exited (1)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The command '/bin/sh -c yarn turbo run build --filter=@calcom/web' returned a non-zero code: 1
ERROR: Service 'calcom' failed to build : Build failed
Ch3nYuY commented 1 year ago

@Septa2112 It looks like the import of Inter from "next/font/google" has failed, and you can use a local method next/font/local to import the Inter font. You may need to find the font you want to use, such asInter-latin, from https://fonts.googleapis.com/css2?family=Inter:wght@400&display=swap.

You will need to download the .woff2 file from the url, https://fonts.gstatic.com/s/inter/v12/UcCO3FwrK3iLTeHuS_fvQtMwCp50KnMw2boKoduKmMEVuLyfAZ9hiA.woff2, copy it to the directory calcom-docker/calcom/apps/web/fonts and rename it to Inter-Latin.woff2. Then, you will need to import the interFont locally in the your app.

The code you need to modify is as follows:

// calcom-docker/calcom/apps/web/pages/_app.tsx
// import { Inter } from "next/font/google";
import localFont from "next/font/local";

// replace it with local method
// const interFont = Inter({ subsets: ["latin"], variable: "--font-inter", preload: true, display: "swap" });
const interFont = localFont({
  src: "../fonts/Inter-Latin.woff2",
  variable: "--font-inter",
  preload: true,
  display: "swap",
});
Septa2112 commented 1 year ago

@chenyuyang2022 Thanks a lot! I will try.

krumware commented 1 year ago

this may have also been fixed more recently than your clone, as the nightly build doesn't show this issue. thanks for reporting!