File tree Expand file tree Collapse file tree 1 file changed +60
-0
lines changed
Expand file tree Collapse file tree 1 file changed +60
-0
lines changed Original file line number Diff line number Diff line change 1+ name : ' Docker on tmpfs'
2+ description : " Updates the runner's swap space, mounts a tmpfs on /var/lib/docker and restarts the daemon."
3+ author : ' JonasAlfredsson'
4+ branding :
5+ icon : ' shuffle'
6+ color : ' yellow'
7+
8+ inputs :
9+ tmpfs_size :
10+ description : ' Size of the tmpfs mount to be used (in gigabytes)'
11+ required : false
12+ type : number
13+ default : 5
14+ swap_size :
15+ description : ' Size of the new swap space (in gigabytes)'
16+ required : false
17+ type : number
18+ default : 4
19+ swap_location :
20+ description : ' Path to the new swap file'
21+ required : false
22+ default : ' /mnt/swapfile'
23+
24+ runs :
25+ using : " composite"
26+ steps :
27+ - name : Replace the current swap file
28+ if : inputs.swap_size != 4 || inputs.swap_location != '/mnt/swapfile'
29+ shell : bash
30+ run : |
31+ sudo swapoff /mnt/swapfile
32+
33+ sudo rm -v /mnt/swapfile
34+
35+ sudo fallocate -l ${{ inputs.swap_size }}G "${{ inputs.swap_location }}"
36+
37+ sudo chmod 600 "${{ inputs.swap_location }}"
38+
39+ sudo mkswap "${{ inputs.swap_location }}"
40+
41+ sudo swapon "${{ inputs.swap_location }}"
42+
43+ - name : Show current memory and swap status
44+ shell : bash
45+ run : |
46+ sudo free -h
47+ echo
48+ sudo swapon --show
49+
50+ - name : Mount a tmpfs over /var/lib/docker
51+ shell : bash
52+ run : |
53+ if [ ! -d "/var/lib/docker" ]; then
54+ echo "Directory '/var/lib/docker' not found"
55+ ecit 1
56+ fi
57+
58+ sudo mount -t tmpfs -o size=${{ inputs.tmpfs_size }}G tmpfs /var/lib/docker
59+
60+ sudo systemctl restart docker
You can’t perform that action at this time.
0 commit comments