Add create raspberry pi image WIP #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create Raspberry Pi Image | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Increase Docker storage size | |
run: | | |
sudo systemctl stop docker | |
sudo rm -rf /var/lib/docker | |
sudo mkdir /mnt/docker | |
sudo ln -s /mnt/docker /var/lib/docker | |
sudo systemctl start docker | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Install qemu-user-static | |
run: sudo apt-get update && sudo apt-get install -y qemu-user-static | |
- name: Build Raspberry Pi OS Image | |
run: | | |
# Clone pi-gen repository | |
git clone https://github.com/RPi-Distro/pi-gen.git | |
cd pi-gen | |
# Customize the image | |
echo "IMG_NAME='custom-rpi-image'" > config | |
mkdir -p stage2/02-custom | |
echo "FROM balenalib/rpi-raspbian:latest" > stage2/02-custom/Dockerfile | |
echo "RUN apt-get update && apt-get install -y python3 python3-pip cron" >> stage2/02-custom/Dockerfile | |
echo "COPY requirements.txt /tmp/" >> stage2/02-custom/Dockerfile | |
echo "RUN pip3 install -r /tmp/requirements.txt" >> stage2/02-custom/Dockerfile | |
echo "COPY GuiApp /home/pi/GuiApp" >> stage2/02-custom/Dockerfile | |
echo "RUN echo '@reboot python3 /home/pi/GuiApp/main.py' | crontab -" >> stage2/02-custom/Dockerfile | |
# Build the image | |
./build-docker.sh | |
- name: Save Raspberry Pi OS Image | |
run: | | |
IMAGE=$(ls deploy/*.zip) | |
mv $IMAGE rpi-image.zip | |
- name: Upload Image Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: rpi-image | |
path: rpi-image.zip |