Skip to content

Commit

Permalink
fix: add support form building an arm64 version for Pi 4
Browse files Browse the repository at this point in the history
  • Loading branch information
nicomiguelino committed Jan 13, 2025
1 parent a0841a1 commit 9749c82
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,13 @@ jobs:
- name: Set Docker tag
run: |
echo "GIT_SHORT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "BOARD=${{ matrix.board }}" >> $GITHUB_ENV
if [ "${{ matrix.board }}" == "pi4" ]; then
echo "BOARD=${{ matrix.board }}-64" >> $GITHUB_ENV
else
echo "BOARD=${{ matrix.board }}" >> $GITHUB_ENV
fi
echo "SHM_SIZE=256mb" >> $GITHUB_ENV
- name: Prepare Balena file
Expand Down
12 changes: 10 additions & 2 deletions tools/image_builder/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,18 @@ def main(
for service in services_to_build:
docker_tags = [
f'screenly/anthias-{service}:{docker_tag}',
f'screenly/anthias-{service}:{git_short_hash}-{board}',
f'screenly/srly-ose-{service}:{docker_tag}',
f'screenly/srly-ose-{service}:{git_short_hash}-{board}',
]
if board == 'pi4' and platform == 'linux/arm64/v8':
docker_tags.extend([
f'screenly/anthias-{service}:{git_short_hash}-{board}-64',
f'screenly/srly-ose-{service}:{git_short_hash}-{board}-64',
])
else:
docker_tags.extend([
f'screenly/anthias-{service}:{git_short_hash}-{board}',
f'screenly/srly-ose-{service}:{git_short_hash}-{board}',
])

build_image(
service,
Expand Down
11 changes: 8 additions & 3 deletions tools/image_builder/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,16 @@ def get_build_parameters(build_target: str) -> dict:
return default_build_parameters


def get_docker_tag(git_branch: str, board: str) -> str:
def get_docker_tag(git_branch: str, board: str, platform: str) -> str:
result_board = board

if platform == 'linux/arm64/v8' and board == 'pi4':
result_board = f'{board}-64'

if git_branch == 'master':
return f'latest-{board}'
return f'latest-{result_board}'
else:
return f'{git_branch}-{board}'
return f'{git_branch}-{result_board}'


def generate_dockerfile(service: str, context: dict) -> None:
Expand Down

0 comments on commit 9749c82

Please sign in to comment.