83 lines
3.9 KiB
Docker
Executable File
83 lines
3.9 KiB
Docker
Executable File
#=======================================================================
|
|
# FILE: ci/Dockerfile
|
|
# DESC: aarch64 (RK3588 / Ubuntu 20.04) build & test environment.
|
|
# - Ubuntu 20.04 arm64 base (matches the target board)
|
|
# - MOOS-IvP built from source and installed to /usr/local
|
|
# - jsoncpp (the only extra dep used by pPowerManger)
|
|
# MOOS-IvP is cloned from the internal Gitea mirror (UUV/moos-ivp)
|
|
# via a BuildKit secret (github.com is unreachable from the CN
|
|
# runner). PROJ/UTM are disabled to avoid github-based CPM fetches.
|
|
#=======================================================================
|
|
|
|
FROM arm64v8/ubuntu:20.04
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
#-----------------------------------------------------------------------
|
|
# Use Aliyun mirror for apt (faster from CN) then install toolchain
|
|
#-----------------------------------------------------------------------
|
|
RUN sed -i \
|
|
-e 's|http://ports.ubuntu.com/ubuntu-ports|http://mirrors.aliyun.com/ubuntu-ports|g' \
|
|
-e 's|http://archive.ubuntu.com/ubuntu|http://mirrors.aliyun.com/ubuntu|g' \
|
|
/etc/apt/sources.list && \
|
|
apt-get update && apt-get install -y --no-install-recommends \
|
|
build-essential \
|
|
cmake \
|
|
git \
|
|
ca-certificates \
|
|
libjsoncpp-dev \
|
|
rsync \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
#-----------------------------------------------------------------------
|
|
# Clone MOOS-IvP from the internal Gitea mirror
|
|
# (token passed via BuildKit secret, not baked into the image)
|
|
#-----------------------------------------------------------------------
|
|
RUN --mount=type=secret,id=gitea_token \
|
|
set -eux; \
|
|
TOKEN="$(cat /run/secrets/gitea_token)"; \
|
|
git clone --depth 1 "https://zjk:${TOKEN}@gitea2.zhaojingkui.xyz/UUV/moos-ivp.git" /opt/moos-ivp; \
|
|
git -C /opt/moos-ivp remote set-url origin "https://gitea2.zhaojingkui.xyz/UUV/moos-ivp.git"
|
|
|
|
#-----------------------------------------------------------------------
|
|
# Build & install MOOS-IvP (bundles MOOS core + essentials + geodesy + ivp)
|
|
# build-moos.sh -m : skip GUI tools (no FLTK needed)
|
|
# build-ivp.sh -n : skip GUI apps (no FLTK needed)
|
|
# Installs libMOOS + MOOSConfig.cmake + ivp headers/libs to /usr/local,
|
|
# matching the layout expected by the project's top-level CMakeLists.txt.
|
|
#-----------------------------------------------------------------------
|
|
WORKDIR /opt/moos-ivp
|
|
|
|
RUN ./build-moos.sh -m -j"$(nproc)" && \
|
|
make -C build/MOOS/MOOSCore install && \
|
|
./build-ivp.sh -n -j"$(nproc)" && \
|
|
make -C build/ivp install && \
|
|
ldconfig
|
|
|
|
#-----------------------------------------------------------------------
|
|
# netbase provides /etc/protocols, which MOOS needs at runtime
|
|
# (getprotobyname("tcp")). The base image lacks it, so MOOSDB would throw
|
|
# XPCException "Could Not Get Protocol By Name" at startup without it.
|
|
# python3 is used by the integration DB check (check_db.py).
|
|
# Kept as a final layer so the (expensive) MOOS-IvP build stays cached.
|
|
#-----------------------------------------------------------------------
|
|
RUN apt-get update && apt-get install -y --no-install-recommends netbase python3 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
#-----------------------------------------------------------------------
|
|
# GoogleTest (for unit tests) from the internal Gitea mirror.
|
|
# Cloned via the same BuildKit secret as MOOS-IvP; installed to /usr/local
|
|
# so `find_package(GTest)` works both inside the container and locally.
|
|
#-----------------------------------------------------------------------
|
|
RUN --mount=type=secret,id=gitea_token \
|
|
set -eux; \
|
|
TOKEN="$(cat /run/secrets/gitea_token)"; \
|
|
git clone --depth 1 "https://zjk:${TOKEN}@gitea2.zhaojingkui.xyz/zjk/googletest.git" /opt/googletest; \
|
|
mkdir -p /opt/googletest/build && cd /opt/googletest/build && \
|
|
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_GMOCK=ON .. && \
|
|
make -j"$(nproc)" && \
|
|
make install && \
|
|
ldconfig
|
|
|
|
WORKDIR /src
|