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