Although the official docker compose deployment guide from LibreChat documenetation is enough for everyone, I would like to share my own way of deploying LibreChat using Docker and Docker Compose
- Using the official prebuilt image to avoid running
docker build
command - Already provided configuration of OpenAI, Gemini, Mistral, OpenRouter, BingAI, DALLE. Just put yout API key in the
all-api-key.env
file and you are good to go - Enforced mongodb protection through the creation of separate database with a separate username and passwords.
- Separate environment files for different sections of the configuration, allowing for better environment management.
- An external Docker bridge network for configuring access to other self-hosted LLM providers (
copilot-gpt4-service
in this case). - Different profiles for local and production environments, with a common base
compose.yml
.
Before you begin, ensure you have the following installed:
- Docker
- Docker Compose
Follow these steps to get your development environment set up:
- Clone this repository or download the ZIP file.
- Navigate to the project directory.
- Fill in your API keys in the
all-api-key.env
file. - (Optional but highly recommended for the best practice of security) Complete all the
# TODO
inlibrechat/env
Note that the "llm-http-global-network" network will be used by both librechat
and copilot-gpt4-service
. The network is declared as an external bridge network in both compose.yml
files, and created when you run any of the startup shell scripts, or this command below:
./create-llm-network.sh
For local debugging, use the boot-local.sh
and shutdown-local.sh
scripts. These scripts use the compose.local.yml
file and expose the necessary ports for local debugging.
To start the service:
./boot-local.sh
To shutdown the service:
./shutdown-local.sh
In a production environment, use the boot-production.sh
and shutdown-production.sh
scripts. These scripts use the compose.prod.yml
file.
To start the service:
./boot-production.sh
To shutdown the service:
./shutdown-production.sh