|
| 1 | +## 🐳 Docker Deployment |
| 2 | + |
| 3 | +For users who prefer containerized deployment, we now provide Docker deployment options. This is particularly useful for: |
| 4 | + |
| 5 | +- Running the service on your own server instead of GitHub Actions |
| 6 | +- Better resource control (CPU/RAM allocation) |
| 7 | +- Easier environment management |
| 8 | +- Persistent logging and model caching |
| 9 | +- **Prerequisites**: |
| 10 | + - Docker installed ([Installation Guide](https://docs.docker.com/engine/install/)) |
| 11 | + - Docker Compose (usually included with Docker Desktop) |
| 12 | + - Configured Docker image registry mirror (for faster builds in some regions) |
| 13 | + |
| 14 | +### Quick Start with Docker |
| 15 | + |
| 16 | +1. Clone the repository: |
| 17 | +```bash |
| 18 | +git clone https://github.com/TideDra/zotero-arxiv-daily.git |
| 19 | +cd zotero-arxiv-daily |
| 20 | +``` |
| 21 | + |
| 22 | +2. Build the Docker image (recommended for customization): |
| 23 | +```bash |
| 24 | +docker build . -t local/zotero-arxiv-daily:latest |
| 25 | +``` |
| 26 | + |
| 27 | +3. Create necessary directories: |
| 28 | +```bash |
| 29 | +mkdir -p logs models |
| 30 | +``` |
| 31 | + |
| 32 | +4. Edit the `docker-compose.yml` file to configure your environment variables: |
| 33 | +```yaml |
| 34 | +environment: |
| 35 | + environment: |
| 36 | + # 必填参数(示例值) |
| 37 | + - ZOTERO_ID=1234567 |
| 38 | + - ZOTERO_KEY=AbCdEfGhIjKlMnOpQrStUvWx |
| 39 | + - SMTP_SERVER=smtp.example.com |
| 40 | + - SMTP_PORT=465 |
| 41 | + |
| 42 | + - SENDER_PASSWORD=your_email_password |
| 43 | + |
| 44 | + |
| 45 | + # 可选参数(带默认值) |
| 46 | + - ZOTERO_IGNORE=already_read_papers |
| 47 | + - ARXIV_QUERY=cs.AI+cs.CV+cs.LG+cs.CL |
| 48 | + - SEND_EMPTY=False |
| 49 | + - MAX_PAPER_NUM=5 |
| 50 | + - USE_LLM_API=1 |
| 51 | + - OPENAI_API_KEY=sk-your-openai-key-here |
| 52 | + - OPENAI_API_BASE=https://api.openai.com/v1 |
| 53 | + - MODEL_NAME=Qwen/Qwen1.5-7B-Instruct |
| 54 | + - LANGUAGE=English |
| 55 | + |
| 56 | + # 新增配置 |
| 57 | + - HF_ENDPOINT=https://hf-mirror.com |
| 58 | + # - TZ=Asia/Shanghai # 时区设置 |
| 59 | + # - http_proxy=http://proxy.example.com:8080 # HTTP代理(可选) |
| 60 | + # - https_proxy=http://proxy.example.com:8080 # HTTPS代理(可选) |
| 61 | + # - no_proxy=localhost,127.0.0.1,.internal # 代理排除项 |
| 62 | +``` |
| 63 | + |
| 64 | +5. Start the service: |
| 65 | +```bash |
| 66 | +docker compose up -d |
| 67 | +``` |
| 68 | + |
| 69 | +### Key Features of Docker Deployment |
| 70 | + |
| 71 | +- **Scheduled Execution**: By default runs daily at 8:00 AM (configurable in `command` section) |
| 72 | +- **Log Persistence**: All logs are saved in the `logs/` directory |
| 73 | +- **Model Caching**: Local LLM models can be cached in `models/` directory |
| 74 | +- **Resource Isolation**: Runs in a contained environment with all dependencies included |
| 75 | +- **Easy Updates**: Simply rebuild the image when updating the service |
| 76 | + |
| 77 | +### Configuration Options |
| 78 | + |
| 79 | +You can customize the deployment by: |
| 80 | + |
| 81 | +1. **Changing schedule time**: Edit the cron expression in `command` section (default: `0 8 * * *` means 8:00 AM daily) |
| 82 | +2. **Using local LLM**: Set `USE_LLM_API=0` and uncomment the models volume |
| 83 | +3. **Proxy settings**: Uncomment and configure proxy environment variables if needed |
| 84 | +4. **Timezone**: Uncomment `TZ` variable to set specific timezone (you may also need to comment `- /etc/localtime:/etc/localtime:ro`) |
| 85 | + |
| 86 | +### Monitoring and Maintenance |
| 87 | + |
| 88 | +- View logs: |
| 89 | +```bash |
| 90 | +docker logs zotero-arxiv-daily |
| 91 | +``` |
| 92 | + |
| 93 | +- Stop the service: |
| 94 | +```bash |
| 95 | +docker compose down |
| 96 | +``` |
| 97 | + |
| 98 | +- Update the service: |
| 99 | +```bash |
| 100 | +git pull origin main |
| 101 | +docker compose down |
| 102 | +docker compose up -d --build |
| 103 | +``` |
| 104 | + |
| 105 | +### Why Choose Docker Deployment? |
| 106 | + |
| 107 | +1. **Consistent Environment**: Eliminates "works on my machine" problems |
| 108 | +2. **Resource Control**: Allocate specific CPU/RAM resources as needed |
| 109 | +3. **Isolation**: Runs separately from your host system |
| 110 | +4. **Portability**: Easy to move between different servers |
| 111 | +5. **Persistent Storage**: Logs and models persist between container restarts |
0 commit comments