Skip to content

Commit 3483ea6

Browse files
authored
Add a PR job for building dockerfiles (backport #929) (#931)
1 parent 9280f69 commit 3483ea6

2 files changed

Lines changed: 51 additions & 26 deletions

File tree

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Dockerfile Build
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
paths:
7+
- "Dockerfile/**"
8+
- ".github/workflows/dockerfile-build.yml"
9+
schedule:
10+
- cron: "17 4 * * MON-FRI"
11+
12+
jobs:
13+
dockerfile-build-scheduled:
14+
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
ros-distro: [humble, jazzy, kilted, lyrical, rolling]
20+
21+
steps:
22+
- name: Checkout distro branch
23+
uses: actions/checkout@v7
24+
with:
25+
ref: ${{ matrix.ros-distro }}
26+
27+
- name: Build Dockerfile
28+
run: |
29+
docker build \
30+
--file Dockerfile/Dockerfile \
31+
--build-arg BASE_IMAGE=ghcr.io/ros-controls/ros:${{ matrix.ros-distro }}-ubuntu-testing \
32+
Dockerfile
33+
34+
dockerfile-build-pr:
35+
if: github.event_name == 'pull_request'
36+
runs-on: ubuntu-latest
37+
38+
steps:
39+
- name: Checkout PR changes
40+
uses: actions/checkout@v7
41+
42+
- name: Build Dockerfile
43+
run: |
44+
docker build \
45+
--file Dockerfile/Dockerfile \
46+
--build-arg BASE_IMAGE=ghcr.io/ros-controls/ros:${{ github.base_ref }}-ubuntu-testing \
47+
Dockerfile

Dockerfile/Dockerfile

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,7 @@
1-
FROM ubuntu:24.04
1+
ARG BASE_IMAGE=ghcr.io/ros-controls/ros:kilted-ubuntu-testing
2+
FROM ${BASE_IMAGE}
23

34
ENV DEBIAN_FRONTEND noninteractive
4-
ENV ROS_DISTRO rolling
5-
6-
# Make sure everything is up to date before building from source
7-
RUN apt-get update \
8-
&& apt-get upgrade -y \
9-
&& apt-get update && apt-get install -q -y --no-install-recommends \
10-
dirmngr \
11-
gnupg \
12-
lsb-release \
13-
wget \
14-
curl \
15-
git \
16-
ca-certificates \
17-
build-essential \
18-
cmake \
19-
&& apt-get clean
20-
21-
RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg && \
22-
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null && \
23-
apt-get update && apt-get install -q -y --no-install-recommends \
24-
python3-colcon-ros \
25-
python3-colcon-common-extensions \
26-
python3-rosdep \
27-
&& apt-get clean
285

296
RUN mkdir -p /home/ros2_ws/src \
307
&& cd /home/ros2_ws/src \
@@ -33,7 +10,8 @@ RUN mkdir -p /home/ros2_ws/src \
3310
else \
3411
git clone https://github.com/ros-controls/gz_ros2_control/ -b ${ROS_DISTRO}; \
3512
fi \
36-
&& rosdep init && rosdep update \
13+
&& rosdep update \
14+
&& apt-get update \
3715
&& rosdep install --from-paths ./ -i -y --rosdistro ${ROS_DISTRO}
3816

3917
RUN cd /home/ros2_ws/ \

0 commit comments

Comments
 (0)