Skip to content

Commit

Permalink
fix: Docker image build and deployment process for Pi 4
Browse files Browse the repository at this point in the history
  • Loading branch information
nicomiguelino committed Jan 9, 2025
1 parent 81c36dd commit a0841a1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
needs: run-tests
strategy:
matrix:
board: ['pi1', 'pi2', 'pi3', 'pi4', 'pi5', 'x86']
board: ['pi1', 'pi2', 'pi3', 'pi4-arm', 'pi4-arm64', 'pi5', 'x86']
python-version: ["3.11"]
runs-on: ubuntu-latest

Expand Down Expand Up @@ -80,9 +80,21 @@ jobs:

- name: Build Containers
run: |
poetry run python -m tools.image_builder \
--build-target=${{ matrix.board }} \
--push
if [ "${{ matrix.board }}" == "pi4-arm" ]; then
poetry run python -m tools.image_builder \
--build-target=pi4 \
--target-platform=linux/arm/v8 \
--push
elif [ "${{ matrix.board }}" == "pi4-arm64" ]; then
poetry run python -m tools.image_builder \
--build-target=pi4 \
--target-platform=linux/arm64/v8 \
--push
else
poetry run python -m tools.image_builder \
--build-target=${{ matrix.board }} \
--push
fi
balena:
if: ${{ github.ref == 'refs/heads/master' }}
Expand Down
9 changes: 7 additions & 2 deletions tools/image_builder/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ def build_image(
default='x86',
type=click.Choice(BUILD_TARGET_OPTIONS),
)
@click.option(
'--target-platform',
help='Override the default target platform',
)
@click.option(
'--service',
default=['all'],
Expand Down Expand Up @@ -157,6 +161,7 @@ def build_image(
def main(
clean_build: bool,
build_target: str,
target_platform: str,
service,
disable_cache_mounts: bool,
environment: str,
Expand All @@ -169,7 +174,7 @@ def main(

build_parameters = get_build_parameters(build_target)
board = build_parameters['board']
target_platform = build_parameters['target_platform']
platform = target_platform or build_parameters['target_platform']
base_image = build_parameters['base_image']

docker_tag = get_docker_tag(git_branch, board)
Expand All @@ -186,7 +191,7 @@ def main(
build_image(
service,
board,
target_platform,
platform,
disable_cache_mounts,
git_hash,
git_short_hash,
Expand Down

0 comments on commit a0841a1

Please sign in to comment.