PX4-Autopilot/Tools/packaging/Dockerfile.sih
Ramon Roche 1079c57fd0 build(packaging): add PX4 SITL .deb packages
Add cmake/cpack infrastructure for building .deb packages from
px4_sitl_sih and px4_sitl_default targets. Includes install rules,
package scripts, Gazebo wrapper, and CI workflow.

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-04-02 15:03:04 -06:00

50 lines
1.7 KiB
Docker

# syntax=docker/dockerfile:1
# PX4 SITL SIH runtime image
# Minimal container that runs PX4 with the SIH physics engine (no Gazebo).
#
# Build:
# make px4_sitl_sih && cd build/px4_sitl_sih && cpack -G DEB && cd ../..
# docker build -f Tools/packaging/Dockerfile.sih -t px4io/px4-sitl-sih:v1.17.0 build/px4_sitl_sih/
#
# Run (Linux):
# docker run --rm -it --network host px4io/px4-sitl-sih:v1.17.0
#
# Run (macOS / Windows):
# docker run --rm -it -p 14550:14550/udp -p 14540:14540/udp -p 19410:19410/udp -p 8888:8888/udp px4io/px4-sitl-sih:v1.17.0
FROM ubuntu:24.04 AS build
COPY px4_*.deb /tmp/
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update \
&& apt-get install -y --no-install-recommends binutils \
&& dpkg -x /tmp/px4_*.deb /staging \
&& strip /staging/opt/px4/bin/px4
FROM ubuntu:24.04
LABEL maintainer="PX4 Development Team"
LABEL description="PX4 SITL with SIH physics (no simulator dependencies)"
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && apt-get install -y --no-install-recommends bc
COPY --from=build /staging/opt/px4 /opt/px4
RUN ln -sf /opt/px4/bin/px4 /usr/bin/px4
# Platform-adaptive entrypoint: detects Docker Desktop (macOS/Windows) via
# host.docker.internal and configures MAVLink + DDS to target the host.
COPY px4-entrypoint.sh /opt/px4/bin/px4-entrypoint.sh
RUN chmod +x /opt/px4/bin/px4-entrypoint.sh
ENV PX4_SIM_MODEL=sihsim_quadx
ENV HOME=/root
# MAVLink (QGC, MAVSDK), DDS (ROS 2), jMAVSim/viewer display
EXPOSE 14550/udp 14540/udp 19410/udp 8888/udp
WORKDIR /root
ENTRYPOINT ["/opt/px4/bin/px4-entrypoint.sh"]
CMD []