Skip to content

Commit

Permalink
multiarch (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-hanheide authored Jan 11, 2025
1 parent e78450e commit 905e9f9
Showing 1 changed file with 12 additions and 78 deletions.
90 changes: 12 additions & 78 deletions .github/workflows/container-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,87 +13,20 @@ on:
jobs:
build-docker-image:
if: github.repository_owner == 'LCAS'
runs-on: lcas
runs-on:
- lcas
- qemu
strategy:
fail-fast: false
matrix:
include:
- base_image: lcas.lincoln.ac.uk/lcas/limo_platform_amd64:1
- base_image: lcas.lincoln.ac.uk/lcas/limo_platform:1
push_image: lcas.lincoln.ac.uk/devcontainer/ros2-teaching

steps:
- name: Node Js
uses: actions/setup-node@v4
with:
node-version: "^16.13.0 || >=18.0.0"

- uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: 'recursive'

- name: What
run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV

- name: Docker Login LCAS
uses: docker/login-action@v3
with:
registry: lcas.lincoln.ac.uk
username: ${{ secrets.LCAS_REGISTRY_PUSHER }}
password: ${{ secrets.LCAS_REGISTRY_TOKEN }}

- name: Docker meta
id: meta_public
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
${{ matrix.push_image }}
${{ matrix.push_image }}-amd64
# generate Docker tags based on the following events/attributes
tags: |
type=raw,value=staging
type=raw,enable=${{ github.event_name != 'pull_request' }},value=latest
type=ref,enable=${{ github.event_name != 'pull_request' }},event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Build Public Docker Image
uses: docker/build-push-action@v6
with:
context: .
file: .devcontainer/Dockerfile
platforms: linux/amd64
pull: true
push: true
tags: ${{ steps.meta_public.outputs.tags }}
labels: ${{ steps.meta_public.outputs.labels }}
target: compiled
build-args: |
BASE_IMAGE=${{ matrix.base_image }}
BRANCH=${{ env.BRANCH }}
build-arm-docker-image:
if: github.repository_owner == 'LCAS'
runs-on:
- lcas-runc
- runc
strategy:
fail-fast: false
matrix:
include:
- base_image: lcas.lincoln.ac.uk/lcas/limo_platform_arm64:1
ros_distro: humble
push_image: lcas.lincoln.ac.uk/devcontainer/ros2-teaching-arm64

steps:
- name: Node Js
uses: actions/setup-node@v4
with:
node-version: "^16.13.0 || >=18.0.0"

- uses: actions/checkout@v3
with:
fetch-depth: 1
Expand All @@ -108,20 +41,21 @@ jobs:
registry: lcas.lincoln.ac.uk
username: ${{ secrets.LCAS_REGISTRY_PUSHER }}
password: ${{ secrets.LCAS_REGISTRY_TOKEN }}


- name: "image name from repo name"
id: docker_image_name
run: echo "docker_image=${{ github.repository }}" | tr '[:upper:]' '[:lower:]' |sed 's/[^0-9,a-z,A-Z,=,_,\/]/-/g' >>${GITHUB_OUTPUT}

- name: Docker meta
id: meta_public
uses: docker/metadata-action@v5
with:
flavor: |
latest=false
# list of Docker images to use as base name for tags
images: |
${{ matrix.push_image }}
# generate Docker tags based on the following events/attributes
tags: |
type=raw,value=staging
type=raw,enable=${{ github.event_name != 'pull_request' }},value=latest
type=ref,enable=${{ github.event_name != 'pull_request' }},event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
Expand All @@ -132,13 +66,13 @@ jobs:
with:
context: .
file: .devcontainer/Dockerfile
platforms: linux/arm64
pull: true
platforms: linux/amd64,linux/arm64
push: true
cache-from: type=registry,ref=lcas.lincoln.ac.uk/cache/${{ steps.docker_image_name.outputs.docker_image }}:latest
cache-to: type=registry,ref=lcas.lincoln.ac.uk/cache/${{ steps.docker_image_name.outputs.docker_image }}:latest,mode=max
tags: ${{ steps.meta_public.outputs.tags }}
labels: ${{ steps.meta_public.outputs.labels }}
target: compiled
build-args: |
BASE_IMAGE=${{ matrix.base_image }}
BRANCH=${{ env.BRANCH }}

0 comments on commit 905e9f9

Please sign in to comment.