Skip to content

Instantly share code, notes, and snippets.

@Icehunter
Created November 26, 2024 03:11
Show Gist options
  • Save Icehunter/41ca452b984aeea78998c727b1460291 to your computer and use it in GitHub Desktop.
Save Icehunter/41ca452b984aeea78998c727b1460291 to your computer and use it in GitHub Desktop.
version: '3.8'
services:
jenkins:
image: jenkins/jenkins:lts
container_name: jenkins
ports:
- "8080:8080"
- "50000:50000"
volumes:
- /mnt/your-larger-volume:/var/jenkins_home
deploy:
resources:
limits:
cpus: '2.0' # Maximum of 2 CPU cores
reservations:
cpus: '1.0' # Guaranteed 1 CPU core
restart: always
swarm-agent:
build:
context: .
dockerfile: Dockerfile
environment:
- MASTER=http://jenkins:8080
- USERNAME=admin
- PASSWORD=your-api-token-or-password
- NAME=swarm-agent-{{.Task}}
- LABELS=docker swarm linux
- EXECUTORS=2
deploy:
replicas: 10
resources:
limits:
cpus: '0.5' # Each agent gets at most 0.5 CPU cores
reservations:
cpus: '0.25' # Guaranteed 0.25 CPU cores for each agent
depends_on:
- jenkins
restart: always
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment