Files
PX4-Autopilot/Tools/packaging/Dockerfile.sih
T
Ramon Roche dcedef6168 build(sim): resolve SITL runtime deps via .deb Depends
The px4-gazebo .deb already declares OpenCV and gstreamer core library
deps via dpkg-shlibdeps, but Dockerfile.gazebo uses dpkg -x which
bypasses resolution. Switch to apt install ./px4-gazebo_*.deb so Depends
are resolved automatically.

Add the 5 gstreamer plugin packages (plugins-base/good/bad/ugly/libav)
to CPACK_DEBIAN_PACKAGE_DEPENDS since they're loaded at runtime via
gst_element_factory_make() and cannot be detected by shlibdeps.

Apply the same apt-install pattern to Dockerfile.sih so both images
build consistently.

Signed-off-by: Ramon Roche <mrpollo@gmail.com>
2026-04-21 15:37:48 -07:00

58 lines
1.9 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:v1.17.0 build/px4_sitl_sih/
#
# Run (Linux):
# docker run --rm -it --network host px4io/px4-sitl: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:v1.17.0
#
# Persist flight logs on the host (ulog files):
# mkdir -p ./px4-logs
# docker run --rm -it --network host \
# -v $(pwd)/px4-logs:/root/.local/share/px4/rootfs/log \
# px4io/px4-sitl:v1.17.0
FROM ubuntu:24.04
LABEL maintainer="PX4 Development Team"
LABEL description="PX4 SITL with SIH physics (no simulator dependencies)"
ENV DEBIAN_FRONTEND=noninteractive
# Install px4 via apt so Depends: are resolved automatically. The binary is
# stripped after install to trim image size (~a few MB).
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 \
/tmp/px4_*.deb \
bc \
binutils \
&& strip /opt/px4/bin/px4 \
&& apt-get purge -y binutils \
&& apt-get autoremove -y \
&& rm -f /tmp/px4_*.deb \
&& 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 []