Deploying Woodpecker CI with Docker Compose: A Lean CI/CD Pipeline for Low-Resource Servers

Quick start (5 min)

Six months ago, our team hit an infrastructure wall: self-hosted GitLab CI runners sat idle on our staging nodes while devouring 4.2 GB of RAM. Shifting to Drone CI felt like a dead end after Harness pivoted its licensing model. We moved to Woodpecker CI instead—a community-led fork of Drone 0.8. We deployed it on a modest €4/month Hetzner CX22 instance (2 vCPU, 4 GB RAM) via Docker Compose. At baseline, the server and agent combined pulled just 68 MB of memory.

Below is a working setup you can bring up in under five minutes using GitHub or Gitea/Forgejo for OAuth.

1. Generate the Shared Secret

Woodpecker servers dispatch pipeline tasks to agents via gRPC. Generate a 32-byte shared secret to authenticate that connection:

openssl rand -hex 32

2. The docker-compose.yml File

Create a dedicated woodpecker directory and add this docker-compose.yml file. We map port 8000 for the web UI and reverse proxy traffic, plus port 9000 so external agents can connect over gRPC.

version: '3.8'

services:
  woodpecker-server:
    image: woodpeckerci/woodpecker-server:v2.7.2
    container_name: woodpecker-server
    restart: always
    ports:
      - "8000:8000"
      - "9000:9000"
    volumes:
      - woodpecker-server-data:/var/lib/woodpecker
    environment:
      - WOODPECKER_HOST=https://ci.example.com
      - WOODPECKER_SERVER_ADDR=:8000
      - WOODPECKER_GRPC_ADDR=:9000
      - WOODPECKER_GRPC_SECRET=replace_with_openssl_generated_secret
      - WOODPECKER_GITHUB=true
      - WOODPECKER_GITHUB_CLIENT=your_github_oauth_client_id
      - WOODPECKER_GITHUB_SECRET=your_github_oauth_client_secret
      - WOODPECKER_OPEN=true
      - WOODPECKER_ADMIN=your_github_username

  woodpecker-agent:
    image: woodpeckerci/woodpecker-agent:v2.7.2
    container_name: woodpecker-agent
    restart: always
    depends_on:
      - woodpecker-server
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - WOODPECKER_SERVER=woodpecker-server:9000
      - WOODPECKER_GRPC_SECRET=replace_with_openssl_generated_secret
      - WOODPECKER_MAX_WORKFLOWS=2

volumes:
  woodpecker-server-data:

3. Launching and Testing the Stack

Spin up the services in detached mode:

docker compose up -d
docker compose logs -f

Route your reverse proxy (such as Caddy or Nginx) to port 8000 with an SSL certificate. Open your domain in a browser, log in through GitHub OAuth, and toggle activation for your repository. To verify the pipeline, commit this minimal .woodpecker.yaml into your repository root:

steps:
  test:
    image: alpine:3.20
    commands:
      - echo "Pipeline running on Woodpecker CI"
      - uname -a

Deep dive

We ran this setup through roughly 1,400 production pipeline runs over six months. Woodpecker’s resource efficiency comes down to how strictly it decouples coordination from container execution.

Architecture: Server vs. Agent Split

Woodpecker relies on an asynchronous client-server model over gRPC. The Woodpecker Server consumes incoming webhooks, validates git tokens, writes build records to an embedded SQLite database (or external PostgreSQL), and schedules steps onto a task queue. It never touches container runtimes directly.

The Woodpecker Agent pulls work from the queue and drives the Docker engine via the local socket. When a pipeline starts, the agent provisions an isolated Docker network and workspace volume. It executes pipeline stages inside standard OCI containers, extracts logs back to the server, and cleans up the temporary containers immediately after execution. The host stays clean because no background worker runtimes remain lingering in memory.

Resource Footprint Comparison

  • GitLab Runner + Server: Running both components on-prem requires at least 4 GB to 8 GB of RAM. Even running just a standalone GitLab Runner polling gitlab.com sits at 180–320 MB RSS idle.
  • Drone CI: Lightweight and capable, but enterprise feature walls and restrictive licensing shifts stalled its community ecosystem.
  • Woodpecker CI: The server process hovers at 44 MB RSS under light loads, while the agent uses 19 MB. Build processes consume CPU and RAM only while compiling code or executing unit tests.

Pipeline Syntax and Workflow Lifecycle

Woodpecker uses clean, readable YAML. All steps share a single working directory mounted at /woodpecker/src/<repo>, allowing later steps to access compiled artifacts from earlier steps without manual stash operations:

when:
  branch: main
  event: [push, pull_request]

steps:
  lint:
    image: golangci/golangci-lint:v1.59-alpine
    commands:
      - golangci-lint run --timeout=3m

  build:
    image: golang:1.23-alpine
    commands:
      - CGO_ENABLED=0 go build -ldflags="-s -w" -o bin/api .

  publish:
    image: plugins/docker
    settings:
      repo: ghcr.io/my-org/api
      tags: [latest, "${CI_COMMIT_SHA:0:7}"]
      username:
        from_secret: registry_user
      password:
        from_secret: registry_token
    when:
      event: push

Advanced usage

A single node handles typical small team workloads effortlessly. When build volume grows, scaling out requires minimal operational overhead.

1. Distributed Multi-Node Agent Setup

Agents do not need to live alongside the server. In our test environment, a central 2 GB VPS schedules tasks across two 8 GB Raspberry Pi 5 boards (ARM64) and an off-site AMD64 runner.

On remote workers, launch an isolated agent container without opening any inbound network ports:

version: '3.8'

services:
  remote-agent:
    image: woodpeckerci/woodpecker-agent:v2.7.2
    restart: unless-stopped
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - WOODPECKER_SERVER=ci.example.com:9000
      - WOODPECKER_GRPC_SECRET=replace_with_openssl_generated_secret
      - WOODPECKER_AGENT_LABELS=arch=arm64,env=hardware-lab
      - WOODPECKER_MAX_WORKFLOWS=2

Direct jobs to target hardware by specifying labels inside your .woodpecker.yaml file:

labels:
  arch: arm64

2. Managing Encrypted Secrets

Avoid placing tokens in plaintext configuration files. Store secrets through the Woodpecker dashboard or inject them directly via the CLI client. Scope credentials to specific branches and deployment triggers to prevent pipeline exfiltration:

# Store deployment credentials with restricted event triggers
woodpecker secret add \
  --repository my-org/api \
  --name registry_token \
  --value "ghp_abcdef1234567890" \
  --events push,tag

3. Caching Dependencies Between Pipeline Runs

Because each step executes in a fresh container, language package managers re-download dependencies on every run. Mounting host directory caches or applying the volume-cache plugin cut our Go build durations from 2 minutes 40 seconds down to 22 seconds:

steps:
  restore-cache:
    image: meltwater/drone-cache:v1.4.0
    settings:
      backend: "filesystem"
      restore: true
      cache_key: "{{ checksum 'go.sum' }}"
      archive_format: "gzip"
      mount:
        - "/go/pkg/mod"
    volumes:
      - /var/cache/woodpecker:/cache

  build:
    image: golang:1.23-alpine
    commands:
      - go test ./...
      - go build -o bin/api

  rebuild-cache:
    image: meltwater/drone-cache:v1.4.0
    settings:
      backend: "filesystem"
      rebuild: true
      cache_key: "{{ checksum 'go.sum' }}"
      archive_format: "gzip"
      mount:
        - "/go/pkg/mod"
    volumes:
      - /var/cache/woodpecker:/cache

Practical tips

Keeping a CI runner stable on a 20 GB to 40 GB system disk requires disciplined hygiene. Here are three operational safeguards we rely on every day.

Automate Docker Disk Pruning

Frequent container builds accumulate untagged images and dangling build contexts quickly. On a 40 GB NVMe disk, Docker consumed 28 GB within ten days. Add a daily cron script on runner nodes to reclaim space automatically:

# /etc/cron.daily/docker-prune
#!/bin/sh
docker system prune -af --filter "until=48h" --volumes

Set Strict Concurrency Limits

The default concurrency limit for WOODPECKER_MAX_WORKFLOWS is 1. While tempting to increase this, compiling two heavy Node.js or Rust builds simultaneously will invoke the Linux OOM killer on a 2 GB server. Cap it at 1 or 2 concurrent jobs. When build queues back up, spin up an extra $4 VPS worker rather than pushing a tiny box past its memory threshold.

Harden the Docker Socket

Exposing /var/run/docker.sock to containers grants root-equivalent control over the host kernel. If your instance processes public pull requests, turn off open signups (WOODPECKER_OPEN=false). Limit build triggers to vetted contributors, or route high-risk workloads to Woodpecker’s Podman driver for rootless process isolation.

Woodpecker gives small engineering teams straightforward CI/CD without the resource bloat. It provides genuine open-source governance, low memory usage, and zero licensing surprises.

Share: