Add create raspberry pi image WIP #5
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: 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: Build Raspberry Pi Image | |
run: | | |
# Create a base Raspberry Pi OS image | |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | |
docker buildx create --use | |
docker buildx build --platform linux/arm/v7 -t rpi-image --load -f- . <<EOF | |
FROM balenalib/rpi-raspbian:latest | |
# Install Python and required packages | |
RUN apt-get update && apt-get install -y python3 python3-pip cron | |
COPY requirements.txt /tmp/ | |
RUN pip3 install -r /tmp/requirements.txt | |
# Copy the application | |
COPY GuiApp /home/pi/GuiApp | |
# Set up the application to run on boot | |
RUN echo "@reboot python3 /home/pi/GuiApp/main.py" | crontab - | |
EOF | |
- name: Save Docker Image | |
run: | | |
docker save rpi-image | gzip > rpi-image.tar.gz | |
- name: Upload Image Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: rpi-image | |
path: rpi-image.tar.gz |