huggingface / chat-ui

Open source codebase powering the HuggingChat app
https://huggingface.co/chat
Apache License 2.0
7.19k stars 1.04k forks source link

Docker build - multiple errors - documentation #614

Open shuther opened 9 months ago

shuther commented 9 months ago

I can't find documentation to build it myself; so I tried: docker-compose build up But I got multiple errors amoung:

chat-ui/.env: line 23: unexpected character "\"" in variable name "\"PROVIDER_URL\": \"\","

Even source .env returned multiple errors; I tried to change the `into a ' with no luck.

My goal was to build it and include it into a docker compose.

nsarrazin commented 9 months ago

Try building it like this

docker build -t chat-ui .

and then run it with docker run not docker compose. docker compose will try to read the .env at the root of the repo but it's not supposed to :sweat_smile:

shuther commented 9 months ago

Still one error, let me know if I miss anything:

> [builder 3/3] RUN --mount=type=secret,id=DOTENV_LOCAL,dst=.env.local     npm run build:                                                                                                                  
1.140                                                                                                                                                                                                       
1.140 > chat-ui@0.6.0 build                                                                                                                                                                                 
1.140 > vite build                                                                                                                                                                                          
1.140 
1.389 ▲ [WARNING] Cannot find base config file "./.svelte-kit/tsconfig.json" [tsconfig.json]
1.389 
1.389     tsconfig.json:2:12:
1.389       2 │   "extends": "./.svelte-kit/tsconfig.json",
1.389         ╵              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1.389 
3.214 
3.215 vite v4.3.9 building SSR bundle for production...
3.246 transforming...
6.070 ✓ 215 modules transformed.
6.071 ✓ built in 2.85s
6.071 "OPENID_CONFIG" is not exported by "virtual:$env/static/private", imported by "src/lib/server/auth.ts".
6.071 file: /app/src/lib/server/auth.ts:11:1
6.071  9:   OPENID_TOLERANCE,
6.071 10:   OPENID_RESOURCE,
6.071 11:   OPENID_CONFIG,
6.071       ^
6.071 12: } from "$env/static/private";
6.071 13: import { sha256 } from "$lib/utils/sha256";
6.073 error during build:
6.073 RollupError: "OPENID_CONFIG" is not exported by "virtual:$env/static/private", imported by "src/lib/server/auth.ts".
6.073     at error (file:///app/node_modules/rollup/dist/es/shared/node-entry.js:2125:30)
6.073     at Module.error (file:///app/node_modules/rollup/dist/es/shared/node-entry.js:13452:16)
6.073     at Module.traceVariable (file:///app/node_modules/rollup/dist/es/shared/node-entry.js:13863:29)
6.073     at ModuleScope.findVariable (file:///app/node_modules/rollup/dist/es/shared/node-entry.js:12418:39)
6.073     at Identifier.bind (file:///app/node_modules/rollup/dist/es/shared/node-entry.js:8116:40)
6.073     at CallExpression.bind (file:///app/node_modules/rollup/dist/es/shared/node-entry.js:5735:28)
6.073     at CallExpression.bind (file:///app/node_modules/rollup/dist/es/shared/node-entry.js:9669:15)
6.073     at CallExpression.bind (file:///app/node_modules/rollup/dist/es/shared/node-entry.js:5735:28)
6.073     at CallExpression.bind (file:///app/node_modules/rollup/dist/es/shared/node-entry.js:9669:15)
6.073     at VariableDeclarator.bind (file:///app/node_modules/rollup/dist/es/shared/node-entry.js:5739:23)
6.100 npm notice 
6.101 npm notice New patch version of npm available! 10.2.3 -> 10.2.5
6.101 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.2.5>
6.101 npm notice Run `npm install -g npm@10.2.5` to update!
6.101 npm notice 
TomTom101 commented 8 months ago

"OPENID_CONFIG" is not exported. Add this and potentially all others to .env.local. The simplest docker-compose.yml that works for me is this (after removing .env):

version: '3.3'

services:
  mongodb:
    image: mongo:latest
    ports:
      - '27017:27017'
    restart: always

  huggingchat:
    build: 
      context: .
    ports:
      - '3000:3000'
rodrigobdz commented 3 months ago

The solution is to tell Docker Compose to skip reading .env, as explained here: https://github.com/docker/compose/issues/6741#issuecomment-596205657

docker compose --env-file /dev/null up