feat: add Docker deployment support

- Multi-stage Dockerfile (Node build + Go build + Alpine runtime)
- docker-compose.yml with named volume for data persistence
- In-container Nginx reverse proxy (static files + API)
- Entrypoint script for graceful process management
- .dockerignore for optimized build context
- Updated README (zh/en) with Docker quick start and deployment docs

Closes #14
This commit is contained in:
Awuqing
2026-03-30 07:56:15 +08:00
parent 2ccea28e34
commit 8cf97e439e
7 changed files with 262 additions and 2 deletions

View File

@@ -112,10 +112,30 @@ Supports **multi-node cluster management** for unified control of backup tasks a
### 🌐 Other
- Chinese & English i18n
- Zero external dependencies (embedded SQLite, single binary deployment)
- Docker / Docker Compose one-click deployment
- systemd service support
## Quick Start
### Docker Deployment (Recommended)
```bash
# Clone the project
git clone https://github.com/Awuqing/BackupX.git
cd BackupX
# Start with one command
docker compose up -d
```
To back up host directories, mount them in `docker-compose.yml`:
```yaml
volumes:
- backupx-data:/app/data
- /path/to/backup/source:/mnt/source:ro
```
### Build from Source
```bash
@@ -303,11 +323,16 @@ BackupX/
├── deploy/ # Deployment configs
│ ├── nginx.conf # Nginx reference config
│ ├── backupx.service # systemd service unit
── install.sh # One-click install script
── install.sh # One-click install script
│ └── docker/ # Docker deployment configs
│ ├── nginx.conf # In-container Nginx config
│ └── entrypoint.sh # Container entrypoint script
├── .github/ # GitHub configuration
│ ├── workflows/ci.yml # CI workflow
│ ├── workflows/release.yml # Release workflow
│ └── ISSUE_TEMPLATE/ # Issue templates
├── Dockerfile # Docker multi-stage build
├── docker-compose.yml # Docker Compose config
└── Makefile # Build commands
```
@@ -372,6 +397,29 @@ The install script will automatically:
5. Register and start the systemd service
6. Configure Nginx reverse proxy (if installed)
### Docker Deployment
```bash
# Using docker compose
docker compose up -d
# Or build and run manually
docker build -t backupx .
docker run -d --name backupx -p 8340:8340 -v backupx-data:/app/data backupx
```
Override configuration via environment variables:
```bash
docker run -d --name backupx \
-p 8340:8340 \
-v backupx-data:/app/data \
-e TZ=Asia/Shanghai \
-e BACKUPX_LOG_LEVEL=debug \
-e BACKUPX_BACKUP_MAX_CONCURRENT=4 \
backupx
```
### Manual Deployment
```bash