Skip to content

Commit ce476ac

Browse files
authored
Merge pull request #2568 from mavlink/pr-ci-docker-overhaul
CI: move to docker containers
2 parents e8aecdb + 5d65921 commit ce476ac

31 files changed

+1262
-835
lines changed

.github/workflows/docker.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Build and Push Docker Images
2+
3+
on:
4+
workflow_call:
5+
secrets:
6+
DOCKERHUB_USERNAME:
7+
required: true
8+
DOCKERHUB_PASSWORD:
9+
required: true
10+
11+
jobs:
12+
determine-docker-tag:
13+
name: Determine Docker Image Tag
14+
runs-on: ubuntu-24.04
15+
outputs:
16+
docker_tag: ${{ steps.set-docker-tag.outputs.docker_tag }}
17+
steps:
18+
- name: Set docker tag
19+
id: set-docker-tag
20+
run: |
21+
if [ "${{ github.event_name }}" = "pull_request" ]; then
22+
echo "docker_tag=pr-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
23+
else
24+
echo "docker_tag=latest" >> $GITHUB_OUTPUT
25+
fi
26+
27+
build-docker-images:
28+
name: Build ${{ matrix.name }}
29+
needs: determine-docker-tag
30+
runs-on: ubuntu-24.04
31+
strategy:
32+
fail-fast: false
33+
matrix:
34+
include:
35+
# Always build Ubuntu images
36+
- name: Ubuntu 20.04
37+
dockerfile: Dockerfile-ubuntu-20.04
38+
image: mavsdk-ubuntu-20.04
39+
- name: Ubuntu 22.04
40+
dockerfile: Dockerfile-ubuntu-22.04
41+
image: mavsdk-ubuntu-22.04
42+
- name: Ubuntu 24.04
43+
dockerfile: Dockerfile-ubuntu-24.04
44+
image: mavsdk-ubuntu-24.04
45+
extra_tag: mavsdk-dev
46+
# Add Debian images
47+
- name: Debian 11 (Bullseye)
48+
dockerfile: Dockerfile-debian-11
49+
image: mavsdk-debian-11
50+
- name: Debian 12 (Bookworm)
51+
dockerfile: Dockerfile-debian-12
52+
image: mavsdk-debian-12
53+
- name: Debian 13 (Trixie)
54+
dockerfile: Dockerfile-debian-13
55+
image: mavsdk-debian-13
56+
- name: Dockcross ARMv6
57+
dockerfile: Dockerfile.dockcross-linux-armv6-custom
58+
image: mavsdk-dockcross-linux-armv6-custom
59+
- name: Dockcross ARMv7
60+
dockerfile: Dockerfile.dockcross-linux-armv7-custom
61+
image: mavsdk-dockcross-linux-armv7-custom
62+
- name: Dockcross ARM64
63+
dockerfile: Dockerfile.dockcross-linux-arm64-custom
64+
image: mavsdk-dockcross-linux-arm64-custom
65+
- name: Dockcross ARM64 LTS
66+
dockerfile: Dockerfile.dockcross-linux-arm64-lts-custom
67+
image: mavsdk-dockcross-linux-arm64-lts-custom
68+
steps:
69+
- uses: actions/checkout@v4
70+
71+
- name: Set up Docker Buildx
72+
uses: docker/setup-buildx-action@v3
73+
74+
- name: Login to DockerHub
75+
uses: docker/login-action@v3
76+
with:
77+
registry: docker.io
78+
username: ${{ secrets.DOCKERHUB_USERNAME }}
79+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
80+
81+
- name: Set tags
82+
id: set-tags
83+
run: |
84+
TAGS="docker.io/mavsdk/${{ matrix.image }}:${{ needs.determine-docker-tag.outputs.docker_tag }}"
85+
if [ -n "${{ matrix.extra_tag }}" ] && [ "${{ github.event_name }}" != "pull_request" ]; then
86+
TAGS="$TAGS,docker.io/mavsdk/${{ matrix.extra_tag }}:${{ needs.determine-docker-tag.outputs.docker_tag }}"
87+
fi
88+
echo "tags=$TAGS" >> $GITHUB_OUTPUT
89+
90+
- name: Build and push image
91+
uses: docker/build-push-action@v5
92+
with:
93+
context: ./docker
94+
file: ./docker/${{ matrix.dockerfile }}
95+
push: true
96+
tags: ${{ steps.set-tags.outputs.tags }}

0 commit comments

Comments
 (0)