Skip to content

Commit

Permalink
Downsize releng and release images so they are less than 2GB compress…
Browse files Browse the repository at this point in the history
…ed (#206)

- drop some dependencies that are not so required
- use pishrink to shrink the file system
- perform shallow clones
- clean up after building
  • Loading branch information
pguyot committed May 7, 2021
1 parent cdf31cb commit c9ccde2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/arm-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
uses: pguyot/arm-runner-action@v1
id: arm_runner_tests
with:
image_additional_mb: 4096
image_additional_mb: 3584
base_image: 'raspios_lite:2021-03-04'
cpu: 'arm1176'
copy_repository_path: /home/pi/pynab
Expand Down Expand Up @@ -47,18 +47,21 @@ jobs:
uses: pguyot/arm-runner-action@v1
id: arm_runner_install
with:
image_additional_mb: 4096
image_additional_mb: 3584
base_image: 'raspios_lite:2021-03-04'
cpu: 'arm1176'
commands: |
echo GITHUB_BRANCH=${{ steps.image_and_branch_name.outputs.LOCAL_BRANCH }}
echo GITHUB_REPOSITORY=${{ github.repository }}
sudo GITHUB_BRANCH=${{ steps.image_and_branch_name.outputs.LOCAL_BRANCH }} GITHUB_REPOSITORY=${{ github.repository }} /bin/bash setup
sudo rm -rf /pynab
- name: Compress the release image
sudo apt-get autoremove -y
sudo apt-get clean
- name: Compress the release image with pishrink
run: |
mv ${{ steps.arm_runner_install.outputs.image }} pynab-${{ steps.image_and_branch_name.outputs.IMAGE_NAME_SUFFIX }}.img
xz -0 -T 0 -v pynab-${{ steps.image_and_branch_name.outputs.IMAGE_NAME_SUFFIX }}.img
wget https://raw.githubusercontent.com/Drewsif/PiShrink/fa3c7a27406e7c0a1c7b8688e330f14a766be1ba/pishrink.sh
sudo bash pishrink.sh -Z -a -p pynab-${{ steps.image_and_branch_name.outputs.IMAGE_NAME_SUFFIX }}.img
- name: Create release with releng image
if: github.ref == 'refs/heads/releng'
uses: "marvinpinto/action-automatic-releases@v1.1.2"
Expand Down
15 changes: 7 additions & 8 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ if [ $upgrade -eq 1 -a $makerfaire2018 -eq 0 -a -d /home/pi/wm8960 ]; then
sudo chown -R ${owner} .git
pull=`git pull`
if [ "$pull" != "Already up to date." ]; then
make && sudo make install
make && sudo make install && make clean
sudo touch /tmp/pynab.upgrade.reboot
fi
fi
Expand All @@ -85,14 +85,14 @@ if [ $upgrade -eq 1 ]; then
sudo chown -R ${owner} .git
pull=`git pull`
if [ "$pull" != "Already up to date." ]; then
make && sudo make install
make && sudo make install && make clean
sudo touch /tmp/pynab.upgrade.reboot
fi
else
cd /home/pi
git clone https://github.com/pguyot/tagtagtag-ears
cd tagtagtag-ears
make && sudo make install
make && sudo make install && make clean
sudo touch /tmp/pynab.upgrade.reboot
fi
else
Expand All @@ -109,14 +109,14 @@ if [ $upgrade -eq 1 ]; then
sudo chown -R ${owner} .git
pull=`git pull`
if [ "$pull" != "Already up to date." ]; then
make && sudo make install
make && sudo make install && make clean
sudo touch /tmp/pynab.upgrade.reboot
fi
else
cd /home/pi
git clone https://github.com/pguyot/cr14
cd cr14
make && sudo make install
make && sudo make install && make clean
sudo touch /tmp/pynab.upgrade.reboot
fi
else
Expand Down Expand Up @@ -185,9 +185,8 @@ if [ $upgrade -eq 1 ]; then
echo "Updating Python requirements - 7/14" > /tmp/pynab.upgrade
fi
# Start with wheel which is required to compile some of the other requirements
venv/bin/pip uninstall -y meteofrance #remove old meteofrance API
venv/bin/pip install wheel
venv/bin/pip install -r requirements.txt
venv/bin/pip install --no-cache-dir wheel
venv/bin/pip install --no-cache-dir -r requirements.txt

if [ $makerfaire2018 -eq 0 ]; then
if [ $upgrade -eq 1 ]; then
Expand Down
17 changes: 10 additions & 7 deletions setup
Original file line number Diff line number Diff line change
Expand Up @@ -60,40 +60,43 @@ cat /boot/config.txt | grep "dtoverlay=hifiberry-dac"
echo "Installing required packages"
sudo apt update -y
sudo apt dist-upgrade -y
sudo apt-get install --no-install-recommends -y postgresql libpq-dev git python3 python3-venv python3-dev gettext nginx openssl libssl-dev libffi-dev libmpg123-dev libasound2-dev libatlas-base-dev libgfortran3 libopenblas-dev liblapack-dev gfortran zram-tools
sudo apt-get install --no-install-recommends -y postgresql libpq-dev git python3 python3-venv python3-dev gettext nginx openssl libssl-dev libffi-dev libmpg123-dev libasound2-dev libatlas-base-dev libgfortran3 libopenblas-dev liblapack-dev zram-tools

echo "Installing sound driver for Ulule 2019 cards"
sudo apt-get install --no-install-recommends raspberrypi-kernel-headers
cd /home/pi
sudo -u pi git clone -b tagtagtag-sound https://github.com/pguyot/wm8960
sudo -u pi git clone --depth 1 -b tagtagtag-sound https://github.com/pguyot/wm8960
cd /home/pi/wm8960
make
sudo make install
make clean

echo "Installing ears driver"
cd /home/pi
sudo -u pi git clone https://github.com/pguyot/tagtagtag-ears
sudo -u pi git clone --depth 1 https://github.com/pguyot/tagtagtag-ears
cd /home/pi/tagtagtag-ears
make
sudo make install
make clean

echo "Installing cr14 driver"
cd /home/pi
sudo -u pi git clone https://github.com/pguyot/cr14
sudo -u pi git clone --depth 1 https://github.com/pguyot/cr14
cd /home/pi/cr14
make
sudo make install
make clean

repository=${GITHUB_REPOSITORY:-nabaztag2018/pynab}
branch=${GITHUB_BRANCH:-release}
echo "Cloning pynab ${branch} branch from ${repository}"
cd /home/pi
sudo -u pi git clone -b ${branch} https://github.com/${repository}.git
sudo -u pi git clone --depth 1 -b ${branch} https://github.com/${repository}.git

echo "Installing nabblockly"
sudo apt-get install --no-install-recommends -y erlang
sudo apt-get install --no-install-recommends -y erlang-base erlang-dev erlang-inets erlang-tools erlang-xmerl
cd /home/pi/pynab
sudo -u pi git clone https://github.com/pguyot/nabblockly
sudo -u pi git clone --depth 1 https://github.com/pguyot/nabblockly
cd nabblockly
sudo -u pi wget https://s3.amazonaws.com/rebar3/rebar3 && chmod +x rebar3
sudo -u pi ./rebar3 release
Expand Down

0 comments on commit c9ccde2

Please sign in to comment.