docs(readme): add cross-platform amd64 build guide and inline-env test run
This commit is contained in:
parent
23796d6a0c
commit
49eed1f27e
82
README.md
82
README.md
|
|
@ -97,6 +97,88 @@ git pull
|
|||
docker compose up -d --build
|
||||
```
|
||||
|
||||
### Cross-Platform Build (aarch64 → amd64)
|
||||
|
||||
When building on an aarch64/ARM64 machine (Apple Silicon, ARM Windows WSL2, Raspberry Pi) for deployment to an x86_64/amd64 server:
|
||||
|
||||
#### 1. Install buildx
|
||||
|
||||
```bash
|
||||
# Download buildx for arm64
|
||||
BUILDX_VERSION=$(wget -qO- https://api.github.com/repos/docker/buildx/releases/latest | grep tag_name | head -1 | cut -d'"' -f4)
|
||||
wget "https://github.com/docker/buildx/releases/download/${BUILDX_VERSION}/buildx-${BUILDX_VERSION}.linux-arm64" -O ~/.docker/cli-plugins/docker-buildx
|
||||
chmod +x ~/.docker/cli-plugins/docker-buildx
|
||||
```
|
||||
|
||||
#### 2. Register QEMU for amd64 emulation
|
||||
|
||||
```bash
|
||||
docker run --privileged --rm tonistiigi/binfmt --install all
|
||||
```
|
||||
|
||||
#### 3. Build for amd64
|
||||
|
||||
```bash
|
||||
DOCKER_BUILDKIT=1 docker build --platform linux/amd64 -t legco_reranker:amd64 .
|
||||
```
|
||||
|
||||
#### 4. Export and transfer to server
|
||||
|
||||
```bash
|
||||
# Save image to tar file
|
||||
docker save legco_reranker:amd64 -o legco_reranker_amd64.tar
|
||||
|
||||
# Compress (~762MB → ~250MB)
|
||||
gzip legco_reranker_amd64.tar
|
||||
|
||||
# Transfer to server
|
||||
scp legco_reranker_amd64.tar.gz user@server:/path/
|
||||
|
||||
# On the x86_64 server:
|
||||
gunzip legco_reranker_amd64.tar.gz
|
||||
docker load -i legco_reranker_amd64.tar
|
||||
|
||||
# Run
|
||||
docker run -d --name legco -p 80:8000 --env-file backend/.env \
|
||||
-v chroma_data:/app/chroma_db \
|
||||
-v chunk_data:/app/document_chunk \
|
||||
-v sqlite_data:/app/data \
|
||||
legco_reranker:amd64
|
||||
```
|
||||
|
||||
#### 5. Test run (local, port 8888)
|
||||
|
||||
Before transferring to the server, test the amd64 image locally. Pass all config inline (no `--env-file`):
|
||||
|
||||
```bash
|
||||
docker run -d --name legco_test -p 8888:8000 \
|
||||
-e LLM_BASE_URL=https://openrouter.ai/api/v1 \
|
||||
-e LLM_API_KEY=your_key_here \
|
||||
-e LLM_MODEL_NAME=qwen/qwen3.6-35b-a3b \
|
||||
-e LLM_TIMEOUT=60.0 \
|
||||
-e EMBEDDING_MODEL=qwen/qwen3-embedding-4b \
|
||||
-e EMBEDDING_BASE_URL=https://openrouter.ai/api/v1 \
|
||||
-e EMBEDDING_API_KEY=your_key_here \
|
||||
-e CHROMA_DB_PATH=./chroma_db \
|
||||
-e CHUNK_SIZE=1000 \
|
||||
-e CHUNK_OVERLAP=200 \
|
||||
-e RETRIEVAL_N_RESULTS=10 \
|
||||
-e RELEVANCE_THRESHOLD=7.0 \
|
||||
-e PROMPTS_DB_PATH=./data/prompts.db \
|
||||
-e HISTORY_DB_PATH=./data/history.db \
|
||||
-e CORS_ORIGINS='["http://localhost:5173","http://localhost:3000"]' \
|
||||
-v ~/woody/legco/data/chroma_db:/app/chroma_db \
|
||||
-v ~/woody/legco/data/document_chunk:/app/document_chunk \
|
||||
-v ~/woody/legco/data/data:/app/data \
|
||||
legco_reranker:amd64
|
||||
|
||||
# Verify
|
||||
curl http://localhost:8888/health
|
||||
|
||||
# Clean up
|
||||
docker rm -f legco_test
|
||||
```
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
|
|
|
|||
Loading…
Reference in New Issue