-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tools: build px4-dev container in CI with ubuntu 24.04
- Loading branch information
Showing
4 changed files
with
109 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
|
||
name: Container build | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
- 'stable' | ||
- 'beta' | ||
- 'release/**' | ||
pull_request: | ||
branches: | ||
- '*' | ||
|
||
jobs: | ||
build: | ||
name: Build Container | ||
runs-on: [runs-on,runner=8cpu-linux-x64,"image=ubuntu24-full-x64","run-id=${{ github.run_id }}"] | ||
steps: | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-tags: true | ||
submodules: false | ||
|
||
- name: Build and load container image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: Tools/setup | ||
tags: px4-dev:latest | ||
platforms: | | ||
linux/amd64 | ||
load: true | ||
push: false | ||
|
||
- name: make quick_check | ||
uses: addnab/docker-run-action@v3 | ||
with: | ||
image: px4-dev:latest | ||
options: -v ${{ github.workspace }}:/workspace | ||
run: | | ||
cd /workspace | ||
git config --global --add safe.directory /workspace | ||
make px4_sitl_default | ||
make px4_fmu-v6x_default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# PX4 base development environment | ||
FROM ubuntu:24.04 | ||
LABEL maintainer="Daniel Agar <[email protected]>, Ramon Roche <[email protected]>" | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
ENV LANG=C.UTF-8 | ||
ENV LC_ALL=C.UTF-8 | ||
ENV DISPLAY=:99 | ||
ENV TERM=xterm | ||
ENV TZ=UTC | ||
|
||
# SITL UDP PORTS | ||
EXPOSE 14556/udp | ||
EXPOSE 14557/udp | ||
|
||
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh | ||
|
||
# Install PX4 Requirements | ||
COPY requirements.txt /tmp/requirements.txt | ||
COPY ubuntu.sh /tmp/ubuntu.sh | ||
RUN touch /.dockerenv | ||
RUN bash /tmp/ubuntu.sh | ||
|
||
RUN git config --global --add safe.directory '*' | ||
|
||
# create user with id 1001 (jenkins docker workflow default) | ||
RUN useradd --shell /bin/bash -u 1001 -c "" -m user && usermod -a -G dialout user | ||
|
||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] | ||
|
||
CMD ["/bin/bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
echo "[docker-entrypoint.sh] Starting entrypoint" | ||
# Start virtual X server in the background | ||
# - DISPLAY default is :99, set in dockerfile | ||
# - Users can override with `-e DISPLAY=` in `docker run` command to avoid | ||
# running Xvfb and attach their screen | ||
if [[ -x "$(command -v Xvfb)" && "$DISPLAY" == ":99" ]]; then | ||
echo "[docker-entrypoint.sh] Starting Xvfb" | ||
Xvfb :99 -screen 0 1600x1200x24+32 & | ||
fi | ||
|
||
# Check if the ROS_DISTRO is passed and use it | ||
# to source the ROS environment | ||
if [ -n "${ROS_DISTRO}" ]; then | ||
echo "[docker-entrypoint.sh] ROS: ${ROS_DISTRO}" | ||
source "/opt/ros/$ROS_DISTRO/setup.bash" | ||
fi | ||
|
||
echo "[docker-entrypoint.sh] Working Directory: ${pwd}" | ||
|
||
# Use the LOCAL_USER_ID if passed in at runtime | ||
if [ -n "${LOCAL_USER_ID}" ]; then | ||
echo "[docker-entrypoint.sh] Starting with: $LOCAL_USER_ID:user" | ||
# modify existing user's id | ||
usermod -u $LOCAL_USER_ID user | ||
|
||
# run as user | ||
# exec gosu user "$@" | ||
exec "$@" | ||
else | ||
exec "$@" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters