44 lines
2.2 KiB
Docker
44 lines
2.2 KiB
Docker
# syntax=docker/dockerfile:1.7
|
|
|
|
FROM rust@sha256:3914072ca0c3b8aad871db9169a651ccfce30cf58303e5d6f2db16d1d8a7e58f AS sitl-build
|
|
WORKDIR /opt/kaptan
|
|
COPY . .
|
|
# Select the pinned host compiler explicitly rather than inheriting the
|
|
# repository's embedded-target toolchain components. `--locked` makes the
|
|
# resolved source graph an explicit reviewable input to the image build.
|
|
RUN cargo +1.90.0 build --locked --release --package kaptan-sitl
|
|
|
|
# Gazebo Jetty's supported amd64 runtime. The image is intentionally split so
|
|
# the C++ plugin and host control process share no source-time build hack.
|
|
FROM ubuntu@sha256:561618e2c15bf2397621dd04f96926663a3b5616c189cf7e38db7e82f5c538ea AS gazebo-runtime
|
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
RUN apt-get update \
|
|
&& apt-get install --no-install-recommends -y ca-certificates curl gnupg \
|
|
&& curl --fail --location --silent --show-error \
|
|
https://packages.osrfoundation.org/gazebo.gpg \
|
|
--output /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg \
|
|
&& echo "deb [arch=amd64 signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] https://packages.osrfoundation.org/gazebo/ubuntu-stable noble main" \
|
|
> /etc/apt/sources.list.d/gazebo-stable.list \
|
|
&& apt-get update \
|
|
&& apt-get install --no-install-recommends -y gz-sim10-cli \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
FROM gazebo-runtime AS gazebo-build
|
|
RUN apt-get update \
|
|
&& apt-get install --no-install-recommends -y cmake g++ ninja-build pkg-config libgz-sim10-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
COPY tools/sitl /opt/kaptan/sitl
|
|
RUN cmake -G Ninja -S /opt/kaptan/sitl -B /opt/kaptan/sitl/plugin/build \
|
|
&& cmake --build /opt/kaptan/sitl/plugin/build --parallel
|
|
|
|
FROM gazebo-runtime
|
|
ENV HOME=/tmp \
|
|
GZ_SIM_SYSTEM_PLUGIN_PATH=/opt/kaptan/sitl/plugin/build \
|
|
GZ_SIM_RESOURCE_PATH=/opt/kaptan/sitl/worlds
|
|
COPY tools/sitl /opt/kaptan/sitl
|
|
COPY --from=gazebo-build /opt/kaptan/sitl/plugin/build/libkaptan_sitl_quad.so \
|
|
/opt/kaptan/sitl/plugin/build/libkaptan_sitl_quad.so
|
|
COPY --from=sitl-build /opt/kaptan/target/release/kaptan-sitl /usr/local/bin/kaptan-sitl
|
|
RUN chmod 0555 /opt/kaptan/sitl/gazebo-entrypoint.sh /opt/kaptan/sitl/kaptan-sim /usr/local/bin/kaptan-sitl
|