Skip to content

Commit

Permalink
Merge pull request #86 from hmakelin/build-arm-docker
Browse files Browse the repository at this point in the history
Push multi-arch Docker images into GHCR
  • Loading branch information
hmakelin authored Oct 1, 2023
2 parents 2d2a990 + 498bf4c commit 0de19c7
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 47 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/push_gisnav_images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Push latest GISNav multi-arch Docker images to GHCR

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

# Allows running manually from the Actions tab
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
upload:
runs-on: ubuntu-20.04
timeout-minutes: 120
defaults:
run:
shell: bash
steps:
- name: Checkout GISNav
uses: actions/checkout@v3
with:
path: colcon_ws/src/gisnav

- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract git tag from GITHUB_REF
run: echo "TAG=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_ENV
if: startsWith(github.ref, 'refs/tags/')

- name: Setup Docker Buildx
run: |
docker buildx create --use
# TODO: try to use docker-compose.yaml file to avoid having to specify redundant build args here
- name: Build and push GISNav multi-arch Docker images
run: |
cd colcon_ws/src/gisnav
docker buildx build --build-arg ROS_VERSION=humble --push --platform linux/amd64,linux/arm64 -f docker/gisnav/Dockerfile -t ghcr.io/hmakelin/gisnav:${TAG:-latest} .
2 changes: 1 addition & 1 deletion .github/workflows/run_ros2_launch_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Run ROS 2 launch tests

on:
workflow_run:
workflows: [ "Build and upload gisnav Docker image to GHCR" ]
workflows: [ "Push latest GISNav multi-arch Docker images to GHCR" ]
types:
- completed

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Run unit tests

on:
workflow_run:
workflows: [ "Build and upload gisnav Docker image to GHCR" ]
workflows: [ "Push latest GISNav multi-arch Docker images to GHCR" ]
types:
- completed

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Static analysis

on:
workflow_run:
workflows: [ "Build and upload gisnav Docker image to GHCR" ]
workflows: [ "Push latest GISNav multi-arch Docker images to GHCR" ]
types:
- completed

Expand Down
40 changes: 0 additions & 40 deletions .github/workflows/upload_gisnav_image.yml

This file was deleted.

8 changes: 4 additions & 4 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,17 @@ services:
privileged: true

# Note: build context is repository root
# Note 2: The "docker buildx build" command in the push_gisnav_images.yml workflow
# duplicates these build arguments. They should be changed together.
gisnav:
<<: [*base, *ros, *tty, *nvidia-gpu]
#image: "ghcr.io/hmakelin/gisnav:${TAG:-latest}"
image: ghcr.io/hmakelin/gisnav:latest
build:
context: ..
dockerfile: docker/gisnav/Dockerfile
args:
ROS_VERSION: humble
#platforms:
# - "linux/amd64"
# - "linux/arm64"
image: gisnav # used by GitHub upload_gisnav_image CI workflow
command: ros2 launch gisnav px4.dev.launch.py

px4:
Expand Down

0 comments on commit 0de19c7

Please sign in to comment.