fix: support 1GB RAM VPS for Docker image builds
Some checks failed
Docker Cloud Build / Build & Publish Image (push) Has been cancelled
Some checks failed
Docker Cloud Build / Build & Publish Image (push) Has been cancelled
- workflow: limit Node.js to 768MB (NODE_OPTIONS --max-old-space-size) and remove GitHub Actions cache (not supported on Forgejo Actions) - install: auto-create 2GB swapfile when installing Forgejo Runner so the build process does not OOM on low-RAM machines Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
2345f10b21
commit
89c9ed842f
2 changed files with 15 additions and 4 deletions
6
.github/workflows/docker-publish.yml
vendored
6
.github/workflows/docker-publish.yml
vendored
|
|
@ -43,10 +43,10 @@ jobs:
|
|||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: 'yarn'
|
||||
cache-dependency-path: frontend/yarn.lock
|
||||
|
||||
- name: Install Frontend Dependencies & Build
|
||||
env:
|
||||
NODE_OPTIONS: "--max-old-space-size=768"
|
||||
run: |
|
||||
cd frontend
|
||||
yarn install --frozen-lockfile
|
||||
|
|
@ -80,5 +80,3 @@ jobs:
|
|||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
platforms: linux/amd64
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
|
|
|||
13
install.sh
13
install.sh
|
|
@ -778,6 +778,19 @@ do_forgejo_runner_install() {
|
|||
|
||||
mkdir -p "$FORGEJO_RUNNER_DIR"
|
||||
|
||||
# Ensure swap exists for low-RAM VPS (Docker image builds need ~2GB memory)
|
||||
if [ ! -f /swapfile ]; then
|
||||
log_step "Creating 2GB swapfile for build memory..."
|
||||
fallocate -l 2G /swapfile
|
||||
chmod 600 /swapfile
|
||||
mkswap /swapfile > /dev/null
|
||||
swapon /swapfile
|
||||
echo '/swapfile none swap sw 0 0' >> /etc/fstab
|
||||
log_ok "Swapfile created and enabled (persistent across reboots)."
|
||||
else
|
||||
log_ok "Swapfile already exists, skipping."
|
||||
fi
|
||||
|
||||
# gitea/act_runner auto-registers on first start via env vars, then starts daemon
|
||||
log_step "Starting Forgejo Runner (auto-register on first boot)..."
|
||||
docker run -d \
|
||||
|
|
|
|||
Loading…
Reference in a new issue