From 18525f12eb17b9a6016a643a0d1d29280bc09ff8 Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Sat, 1 Jun 2024 14:46:37 +0200 Subject: [PATCH 1/3] Readme: Add instructions to build using Docker Compose --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 023d98ea27e..59f9db0d2b7 100644 --- a/README.md +++ b/README.md @@ -907,6 +907,8 @@ Create a `DOTENV_LOCAL` secret to your HF space with the content of your .env.lo ## Building +### Local + To create a production version of your app: ```bash @@ -917,6 +919,12 @@ You can preview the production build with `npm run preview`. > To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. +### Docker + +```bash +docker compose --env-file /dev/null up --build +``` + ## Config changes for HuggingChat The config file for HuggingChat is stored in the `chart/env/prod.yaml` file. It is the source of truth for the environment variables used for our CI/CD pipeline. For HuggingChat, as we need to customize the app color, as well as the base path, we build a custom docker image. You can find the workflow here. From 573f90a5e61c244fcdd6f09d0e8effa4cee06c2a Mon Sep 17 00:00:00 2001 From: Rodrigo Bermudez Schettino Date: Sat, 1 Jun 2024 15:11:22 +0200 Subject: [PATCH 2/3] Compose: Init Add compose.yaml with Mongo and Chat UI services. Includes support for .env.local file. --- compose.yaml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 compose.yaml diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 00000000000..a7421ce17c9 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,26 @@ +services: + mongo: + image: mongo:latest + expose: + - 27017 + networks: + - huggingchat-mongo + restart: always + + huggingchat: + image: chat-ui:latest + ports: + - "3000:3000" + depends_on: + - mongo + networks: + - huggingchat-mongo + volumes: + - .env.local:/app/.env.local + environment: + - MONGODB_URL=mongodb://mongo:27017 + restart: always + +networks: + huggingchat-mongo: + driver: bridge From 0c7b33a1bc256baf9b2039ed10f18f427b403c47 Mon Sep 17 00:00:00 2001 From: Rodrigo Bermudez Schettino Date: Sat, 1 Jun 2024 15:14:32 +0200 Subject: [PATCH 3/3] Readme: Improve Compose section Add additional instructions in case .env.local is not present. --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 59f9db0d2b7..6f60a8d67c6 100644 --- a/README.md +++ b/README.md @@ -919,7 +919,16 @@ You can preview the production build with `npm run preview`. > To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. -### Docker +### Docker Compose + +If `.env.local` is not present, remove the volume in `compose.yaml` as follows to avoid errors. + +```diff +- volumes: +- - .env.local:/app/.env.local +``` + +Start the app with Docker Compose: ```bash docker compose --env-file /dev/null up --build