|
| 1 | +# Local Docker Build for DocuSeal Plus |
| 2 | + |
| 3 | +Build multi-architecture Docker images (AMD64 + ARM64) locally on your ARM laptop and push to GitHub Container Registry. |
| 4 | + |
| 5 | +## Why Build Locally? |
| 6 | + |
| 7 | +| Build Machine | AMD64 Build | ARM64 Build | |
| 8 | +|---------------|-------------|-------------| |
| 9 | +| **ARM laptop** | Emulated (works well) | Native (fast) | |
| 10 | +| **GitHub Actions** | Native (fast) | Emulated (crashes/timeout) | |
| 11 | + |
| 12 | +Building on an ARM laptop is faster and more reliable for ARM64 images. |
| 13 | + |
| 14 | +## Quick Start |
| 15 | + |
| 16 | +```bash |
| 17 | +# Navigate to this folder |
| 18 | +cd deploy/localbuild |
| 19 | + |
| 20 | +# 1. One-time setup (installs QEMU and buildx) |
| 21 | +./setup.sh |
| 22 | + |
| 23 | +# 2. Copy credentials template and fill in your GitHub PAT |
| 24 | +cp keys.template.yml keys.yml |
| 25 | +nano keys.yml # Add your GitHub username and PAT |
| 26 | + |
| 27 | +# 3. Login to GHCR |
| 28 | +./login-ghcr.sh |
| 29 | + |
| 30 | +# 4. Test build locally (no push) |
| 31 | +./build-test.sh |
| 32 | + |
| 33 | +# 5. Build and push release |
| 34 | +./build-and-push.sh |
| 35 | +``` |
| 36 | + |
| 37 | +## Scripts |
| 38 | + |
| 39 | +| Script | Description | |
| 40 | +|--------|-------------| |
| 41 | +| `setup.sh` | One-time setup for Docker buildx and QEMU | |
| 42 | +| `login-ghcr.sh` | Login to GitHub Container Registry | |
| 43 | +| `build-test.sh` | Test build locally without pushing | |
| 44 | +| `build-and-push.sh` | Interactive build and push to GHCR | |
| 45 | +| `reset-builder.sh` | Fix EOF errors by recreating the builder | |
| 46 | + |
| 47 | +## Credentials Setup |
| 48 | + |
| 49 | +1. Create a GitHub Personal Access Token (PAT) at: https://github.com/settings/tokens |
| 50 | +2. Required permissions: `write:packages`, `read:packages` |
| 51 | +3. Copy `keys.template.yml` to `keys.yml` and fill in your credentials |
| 52 | +4. **Never commit `keys.yml`** - it's in `.gitignore` |
| 53 | + |
| 54 | +## Build Options |
| 55 | + |
| 56 | +When running `build-and-push.sh`: |
| 57 | + |
| 58 | +1. **Dev build** - Tags: `dev-YYYYMMDD-SHA` (no version bump) |
| 59 | +2. **Latest build** - Tags: `latest` + dev tag (no version bump) |
| 60 | +3. **Release build** - Tags: `latest` + base version + full version |
| 61 | + - Auto-increments the 4th digit: `2.3.0.1` → `2.3.0.2` |
| 62 | + - Updates the `VERSION` file |
| 63 | + |
| 64 | +## Version Scheme |
| 65 | + |
| 66 | +- `X.Y.Z` - Base DocuSeal version (upstream) |
| 67 | +- `X.Y.Z.N` - Plus release number |
| 68 | + |
| 69 | +Example: `2.3.0.2` means DocuSeal 2.3.0 with Plus release #2. |
| 70 | + |
| 71 | +## Build Time |
| 72 | + |
| 73 | +On an ARM laptop (e.g., Surface Pro X, Apple Silicon Mac): |
| 74 | + |
| 75 | +- ARM64 only: ~10-15 minutes (native) |
| 76 | +- AMD64 only: ~15-25 minutes (emulated) |
| 77 | +- Both architectures: ~25-40 minutes |
| 78 | + |
| 79 | +## Troubleshooting |
| 80 | + |
| 81 | +### "Error: Buildx not set up" |
| 82 | +Run `./setup.sh` first. |
| 83 | + |
| 84 | +### "Invalid github_pat in keys.yml" |
| 85 | +Make sure you've copied `keys.template.yml` to `keys.yml` and filled in your actual GitHub PAT. |
| 86 | + |
| 87 | +### EOF error / "failed to receive status: rpc error" |
| 88 | +This happens when the buildx daemon connection times out during long emulated builds. |
| 89 | + |
| 90 | +**Fix:** Reset the builder: |
| 91 | +```bash |
| 92 | +./reset-builder.sh |
| 93 | +``` |
| 94 | + |
| 95 | +Or manually: |
| 96 | +```bash |
| 97 | +docker buildx rm multiarch |
| 98 | +./setup.sh |
| 99 | +``` |
| 100 | + |
| 101 | +Then retry your build. The `build-test.sh` script also has an option 4 that does this automatically. |
| 102 | + |
| 103 | +### Build crashes or hangs |
| 104 | +Try building single architecture first with `./build-test.sh` to identify which platform has issues. |
| 105 | + |
| 106 | +### Permission denied |
| 107 | +Make sure scripts are executable: `chmod +x *.sh` |
| 108 | + |
| 109 | +### WSL-specific issues |
| 110 | +If builds fail on WSL, make sure: |
| 111 | +1. Docker Desktop is running in Windows |
| 112 | +2. WSL integration is enabled in Docker Desktop settings |
| 113 | +3. You have enough disk space (builds can use 10-20GB temporarily) |
0 commit comments