Skip to content

Add missing Docker deployment docs #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 114 additions & 0 deletions quickstart/selfhost/docker.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
---
title: "Deploy with Docker"
description: "Deploy NextChat using Docker and Docker Compose"
---

## Quick Start

Run NextChat with a single command:

```bash
docker run -d -p 3000:3000 \
-e OPENAI_API_KEY=sk-xxxx \
-e CODE=your-password \
yidadaa/chatgpt-next-web
```

Visit `http://localhost:3000` and use the access code you set.

## Docker Compose

Create a `docker-compose.yml` file:

```yaml
version: '3'
services:
chatgpt-next-web:
image: yidadaa/chatgpt-next-web:latest
ports:
- "3000:3000"
environment:
- OPENAI_API_KEY=sk-xxxx
- CODE=your-password
- PROXY_URL=http://localhost:7890
restart: unless-stopped
```

Start the service:

```bash
docker-compose up -d
```

## Environment Variables

See [Environment Variables](/quickstart/selfhost/env) for all available options. Common configurations:

- `OPENAI_API_KEY`: Your OpenAI API key
- `CODE`: Access password (optional but recommended)
- `PROXY_URL`: HTTP proxy for API requests
- `BASE_URL`: Custom API endpoint

## Advanced Configuration

### Using Multiple API Keys

```yaml
environment:
- OPENAI_API_KEY=sk-key1,sk-key2,sk-key3
```

### Reverse Proxy with Nginx

```nginx
server {
listen 80;
server_name chat.example.com;

location / {
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
```

### Data Persistence

Mount a volume to persist user settings:

```yaml
volumes:
- ./data:/app/data
```

## Updating

Pull the latest image and restart:

```bash
docker-compose pull
docker-compose up -d
```

## Troubleshooting

### Container won't start
Check logs: `docker logs <container-name>`

### API connection issues
- Verify your API key is valid
- Check if you need a proxy in your region
- Ensure the container can reach external networks

### High memory usage
Add memory limits:

```yaml
deploy:
resources:
limits:
memory: 512M
```