Skip to content

Commit

Permalink
🌱 flag to use swap when building images
Browse files Browse the repository at this point in the history
Signed-off-by: David Zager <[email protected]>
  • Loading branch information
djzager committed Apr 4, 2024
1 parent 1ca9fc3 commit 7c469c5
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/build-push-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ on:
default: "."
required: false
type: string
swap-size-gb:
description: 'Swap space to create, in Gigabytes.'
default: ""
required: false
type: string
secrets:
registry_username:
description: "Quay publish robot"
Expand All @@ -52,6 +57,27 @@ jobs:
matrix:
architecture: ${{ fromJSON(inputs.architectures) }}
steps:
- name: Get more swap space
shell: bash
if: "${{ inputs.swap-size-gb != '' }}"
run: |
echo "Before swap"
free -h
swapon --show
# Make swap
export SWAP_FILE="$(swapon --show=NAME | tail -n 1)"
sudo swapoff "${SWAP_FILE}"
sudo rm "${SWAP_FILE}"
sudo fallocate -l "${{ inputs.swap-size-gb }}"G "${SWAP_FILE}"
sudo chmod 600 "${SWAP_FILE}"
sudo mkswap "${SWAP_FILE}"
sudo swapon "${SWAP_FILE}"
echo "After swap"
free -h
swapon --show
- name: Maximize disk space
shell: bash
run: |
Expand Down

0 comments on commit 7c469c5

Please sign in to comment.