feat(build): now limits hardware usage also on docker

This commit is contained in:
2026-04-27 21:50:20 +02:00
parent 18e834b08c
commit 475ffc8445
3 changed files with 21 additions and 18 deletions
+4 -3
View File
@@ -19,6 +19,7 @@ AUR_MAINTAINER_EMAIL=your@email.com
# How often to poll the AUR for updates, in seconds (default: 3600 = 1 hour) # How often to poll the AUR for updates, in seconds (default: 3600 = 1 hour)
POLL_INTERVAL_SECONDS=3600 POLL_INTERVAL_SECONDS=3600
# Number of CPU cores to use for compilation (default: all available cores) # Number of CPU cores to use for compilation (default: 4)
# Reduce this if you want to leave headroom for other processes on the server # This controls both the make -jN parallelism inside the build and the CPU
# NPROC=4 # cap enforced by Docker on the container. Set it once, it applies everywhere
NPROC=4
+2 -2
View File
@@ -38,7 +38,7 @@ cp .env.example .env
Edit `.env` and fill in: Edit `.env` and fill in:
| Variable | Description | | Variable | Description |
|---------------------------|-----------------------------------------------------------------------| |---------------------------|-----------------------------------------------------------------------------------|
| `GITHUB_TOKEN` | Personal access token with **Contents: read/write** on this repo | | `GITHUB_TOKEN` | Personal access token with **Contents: read/write** on this repo |
| `GITHUB_REPO` | `Brodino96/webkit2gtk-automator` | | `GITHUB_REPO` | `Brodino96/webkit2gtk-automator` |
| `AUR_SSH_KEY_PATH` | Absolute path to the SSH private key registered on your AUR account | | `AUR_SSH_KEY_PATH` | Absolute path to the SSH private key registered on your AUR account |
@@ -46,7 +46,7 @@ Edit `.env` and fill in:
| `AUR_MAINTAINER_NAME` | Your name (written into the published PKGBUILD) | | `AUR_MAINTAINER_NAME` | Your name (written into the published PKGBUILD) |
| `AUR_MAINTAINER_EMAIL` | Your email (written into the published PKGBUILD) | | `AUR_MAINTAINER_EMAIL` | Your email (written into the published PKGBUILD) |
| `POLL_INTERVAL_SECONDS` | How often to check for updates, in seconds (default: `3600`) | | `POLL_INTERVAL_SECONDS` | How often to check for updates, in seconds (default: `3600`) |
| `NPROC` | CPU cores to use for compilation (default: all available) | | `NPROC` | CPU cores for compilation, also caps the container's CPU quota (default: `4`) |
**3) Start the daemon** **3) Start the daemon**
```bash ```bash
+7 -5
View File
@@ -8,14 +8,16 @@ services:
restart: unless-stopped restart: unless-stopped
env_file: env_file:
- .env - .env
# By default Docker exposes all host CPUs to the container. # NPROC in .env controls both the number of compiler jobs (make -jN) and
# You can cap it here or set NPROC in .env to limit parallelism at the build level. # the CPU cap enforced by the kernel. Set it once, it applies everywhere
# cpus: '4' cpus: '${NPROC:-4}'
mem_limit: 12g
memswap_limit: 12g
volumes: volumes:
# Entire project mounted so the container can read/write state, artifacts, # Entire project mounted so the container can read/write state, artifacts,
# and the webkit2gtk / webkit2gtk-bin git repos. # and the webkit2gtk / webkit2gtk-bin git repos
- .:/workspace - .:/workspace
# AUR SSH private key (path set in .env via AUR_SSH_KEY_PATH) # AUR SSH private key (path set in .env via AUR_SSH_KEY_PATH)
- ${AUR_SSH_KEY_PATH}:/run/secrets/aur_id_rsa:ro - ${AUR_SSH_KEY_PATH}:/run/secrets/aur_id_rsa:ro
# No ports needed this is a pure background worker. # No ports needed this is a pure background worker
# Logs are available via: docker compose logs -f # Logs are available via: docker compose logs -f