lobehub/docs/Deployment/Docker-Deployment.md
CanisMinor d1df19a498
🔨 chore: Add docs workflow (#658)
* 🔧 chore: Add docs workflow and update docs files

* 📝 docs: Update wiki docs link
2023-12-14 17:17:43 +08:00

3 KiB

Docker Deployment Guide

We provide Docker Images for you to deploy LobeChat service on your private device.

Install Docker container environment

If already installed, skip this step.

Ubuntu:

$ apt install docker.io

CentOS:

$ yum install docker

Deploy container image

Use the following command to start LobeChat service with one click:

$ docker run -d -p 3210:3210 \
  -e OPENAI_API_KEY=sk-xxxx \
  -e ACCESS_CODE=lobe66 \
  lobehub/lobe-chat

[!NOTE]

  • The default mapped port is 3210. Make sure it is not occupied or manually change the port mapping.
  • Replace sk-xxxx in the above command with your own OpenAI API Key.
  • The password set in the official Docker image is lobe66 by default. Replace it with your own password to improve security.
  • For a complete list of environment variables supported by LobeChat, please refer to the Environment Variables section.

[!WARNING]

If the architecture of your deployed server differs from the container architecture, you may need to perform cross-compilation for Sharp. For further details, please refer to the documentation on Sharp Cross-platform.

Use a proxy address

If you need to use OpenAI service through a proxy, you can use the OPENAI_PROXY_URL environment variable to configure the proxy address:

$ docker run -d -p 3210:3210 \
  -e OPENAI_API_KEY=sk-xxxx \
  -e OPENAI_PROXY_URL=https://api-proxy.com/v1 \
  -e ACCESS_CODE=lobe66 \
  lobehub/lobe-chat

[!NOTE]

As the official Docker image build takes about half an hour, if there is a "update available" prompt after updating deployment, wait for the image to finish building before deploying again.

B Docker Compose

The configuration file for using docker-compose is as follows:

version: '3.8'

services:
  lobe-chat:
    image: lobehub/lobe-chat
    container_name: lobe-chat
    ports:
      - '3210:3210'
    environment:
      OPENAI_API_KEY: sk-xxxx
      OPENAI_PROXY_URL: https://api-proxy.com/v1
      ACCESS_CODE: lobe66