diff --git a/docker/Dockerfile_base-jammy b/docker/Dockerfile_base-jammy index ec65b5e3..3de5d22c 100644 --- a/docker/Dockerfile_base-jammy +++ b/docker/Dockerfile_base-jammy @@ -5,9 +5,9 @@ FROM ubuntu:22.04 LABEL maintainer="Ramon Roche " -ENV DEBIAN_FRONTEND noninteractive -ENV LANG C.UTF-8 -ENV LC_ALL C.UTF-8 +ENV DEBIAN_FRONTEND=noninteractive +ENV LANG=C.UTF-8 +ENV LC_ALL=C.UTF-8 RUN apt-get update && apt-get -y --quiet --no-install-recommends install \ ant \ @@ -47,7 +47,6 @@ RUN apt-get update && apt-get -y --quiet --no-install-recommends install \ python3 \ python3-dev \ python3-pip \ - python3-venv \ rsync \ screen \ shellcheck \ @@ -80,7 +79,7 @@ RUN python3 -m pip install --upgrade pip wheel setuptools # Python 3 dependencies installed by pip RUN python3 -m pip install argparse argcomplete coverage cerberus empy==3.3.4 jinja2 kconfiglib \ matplotlib>=3.0.* numpy nunavut>=1.1.0 packaging pkgconfig pyros-genmsg pyulog \ - pyyaml requests serial six toml psutil pyulog wheel jsonschema pynacl lxml + pyyaml requests pyserial six toml psutil pyulog wheel jsonschema pynacl lxml #RUN python3 -m pip install argcomplete argparse>=1.2 cerberus coverage empy>=3.3 future \ #jinja2>=2.8 jsonschema kconfiglib lxml matplotlib>=3.0.* numpy>=1.13 nunavut>=1.1.0 \ @@ -98,15 +97,16 @@ RUN wget -q https://downloads.sourceforge.net/project/astyle/astyle/astyle%203.1 && rm -rf /tmp/* # create user with id 1001 (jenkins docker workflow default) -RUN useradd --shell /bin/bash -u 1001 -c "" -m user && usermod -a -G dialout user +RUN useradd --shell /bin/bash -u 1001 -c "" -m user && usermod -a -G dialout,plugdev user # setup virtual X server RUN mkdir /tmp/.X11-unix && \ chmod 1777 /tmp/.X11-unix && \ chown -R root:root /tmp/.X11-unix -ENV DISPLAY :99 +ENV DISPLAY=:99 ENV CCACHE_UMASK=000 +ENV FASTRTPSGEN_DIR="/usr/local/bin/" ENV PATH="/usr/lib/ccache:$PATH" ENV TERM=xterm ENV TZ=UTC diff --git a/docker/Dockerfile_base-noble b/docker/Dockerfile_base-noble index a8bea245..a7872a0d 100644 --- a/docker/Dockerfile_base-noble +++ b/docker/Dockerfile_base-noble @@ -5,9 +5,9 @@ FROM ubuntu:24.04 LABEL maintainer="Alexander Lerach " -ENV DEBIAN_FRONTEND noninteractive -ENV LANG C.UTF-8 -ENV LC_ALL C.UTF-8 +ENV DEBIAN_FRONTEND=noninteractive +ENV LANG=C.UTF-8 +ENV LC_ALL=C.UTF-8 RUN apt-get update && apt-get -y --quiet --no-install-recommends install \ ant \ @@ -47,7 +47,6 @@ RUN apt-get update && apt-get -y --quiet --no-install-recommends install \ python3 \ python3-dev \ python3-pip \ - python3-venv \ rsync \ screen \ shellcheck \ @@ -77,7 +76,7 @@ RUN cd /usr/src/gtest \ # Python 3 dependencies installed by pip RUN python3 -m pip install --break-system-packages argparse argcomplete coverage cerberus empy==3.3.4 jinja2 kconfiglib \ matplotlib>=3.0.* numpy nunavut>=1.1.0 packaging pkgconfig pyros-genmsg pyulog \ - pyyaml requests serial six toml psutil pyulog wheel jsonschema pynacl lxml + pyyaml requests pyserial six toml psutil pyulog wheel jsonschema pynacl lxml # manual ccache setup RUN ln -s /usr/bin/ccache /usr/lib/ccache/cc \ @@ -90,13 +89,13 @@ RUN wget -q https://downloads.sourceforge.net/project/astyle/astyle/astyle%203.1 && rm -rf /tmp/* # create user with id 1001 (jenkins docker workflow default) -RUN useradd --shell /bin/bash -u 1001 -c "" -m user && usermod -a -G dialout user +RUN useradd --shell /bin/bash -u 1001 -c "" -m user && usermod -a -G dialout,plugdev user # setup virtual X server RUN mkdir /tmp/.X11-unix && \ chmod 1777 /tmp/.X11-unix && \ chown -R root:root /tmp/.X11-unix -ENV DISPLAY :99 +ENV DISPLAY=:99 ENV CCACHE_UMASK=000 ENV PATH="/usr/lib/ccache:$PATH" diff --git a/docker/Dockerfile_nuttx-jammy b/docker/Dockerfile_nuttx-jammy index d211f269..29ec9ae0 100644 --- a/docker/Dockerfile_nuttx-jammy +++ b/docker/Dockerfile_nuttx-jammy @@ -1,9 +1,11 @@ # -# PX4 NuttX development environment in Ubuntu 20.04 Focal +# PX4 NuttX development environment in Ubuntu 22.04 Jammy +# +# PR for base image author as px4io for replacing me. # -FROM px4io/px4-dev-base-jammy:2024-05-18 -LABEL maintainer="Ramón Roche " +FROM i3salng/px4-dev-base-jammy:2026-01-27 +LABEL maintainer="Antoine Nguyen " RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \ @@ -47,5 +49,7 @@ RUN git clone --depth 1 https://bitbucket.org/nuttx/tools.git /tmp/tools \ # bloaty - https://github.com/google/bloaty RUN git clone --recursive https://github.com/google/bloaty.git /tmp/bloaty \ - && cd /tmp/bloaty && cmake -GNinja . && ninja -j $(nproc) bloaty && cp bloaty /usr/local/bin/ \ + && cd /tmp/bloaty && cmake -B bloaty -G Ninja -S . \ + && ninja -C bloaty -j $(nproc) bloaty \ + && cp bloaty/bloaty /usr/local/bin/ \ && rm -rf /tmp/* diff --git a/docker/Dockerfile_nuttx-noble b/docker/Dockerfile_nuttx-noble index 750cd6de..70df4d6e 100644 --- a/docker/Dockerfile_nuttx-noble +++ b/docker/Dockerfile_nuttx-noble @@ -1,9 +1,11 @@ # # PX4 NuttX development environment in Ubuntu 24.04 Noble +# +# PR for base image author as px4io for replacing me. # -FROM px4io/px4-dev-base-noble:2025-02-10 -LABEL maintainer="Alexander Lerach " +FROM i3salng/px4-dev-base-noble:2026-01-26 +LABEL maintainer="Antoine Nguyen " RUN apt-get update \ && DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \ @@ -47,5 +49,7 @@ RUN git clone --depth 1 https://bitbucket.org/nuttx/tools.git /tmp/tools \ # bloaty - https://github.com/google/bloaty RUN git clone --recursive https://github.com/google/bloaty.git /tmp/bloaty \ - && cd /tmp/bloaty && cmake -GNinja . && ninja -j $(nproc) bloaty && cp bloaty /usr/local/bin/ \ + && cd /tmp/bloaty && cmake -B bloaty -G Ninja -S . \ + && ninja -C bloaty -j $(nproc) bloaty \ + && cp bloaty/bloaty /usr/local/bin/ \ && rm -rf /tmp/* diff --git a/docker/scripts/entrypoint.sh b/docker/scripts/entrypoint.sh index 8d3a51e2..f2210481 100755 --- a/docker/scripts/entrypoint.sh +++ b/docker/scripts/entrypoint.sh @@ -1,4 +1,23 @@ #!/bin/bash +set -e + +USER_NAME=user +TARGET_UID=${LOCAL_USER_ID:-1000} + +# From Ubuntu 24.04 there is existing UID 1000 for ubuntu user/group. +# Detect if it is in conflict with $LOCAL_USER_ID: +detectUIDConflict() { + USER_NAME=user + TARGET_UID=${LOCAL_USER_ID:-1000} + + # Check if UID is already taken + EXISTING_USER=$(getent passwd "$TARGET_UID" | cut -d: -f1 || true) + + if [ -n "$EXISTING_USER" ] && [ "$EXISTING_USER" != "$USER_NAME" ]; then + echo "UID $TARGET_UID already belongs to $EXISTING_USER — removing it" + userdel "$EXISTING_USER" || true + fi +} # Start virtual X server in the background # - DISPLAY default is :99, set in dockerfile @@ -18,8 +37,12 @@ fi # Use the LOCAL_USER_ID if passed in at runtime if [ -n "${LOCAL_USER_ID}" ]; then echo "Starting with UID : $LOCAL_USER_ID" - # modify existing user's id - usermod -u $LOCAL_USER_ID user + # If UID conflicts, delete system user (ubuntu if 24.04) + detectUIDConflict + # Now it's safe to modify existing user's id + usermod -u "$TARGET_UID" "$USER_NAME" + # Fix ownership of home (important!) + chown -R "$TARGET_UID":"$TARGET_UID" "/home/$USER_NAME" || true # run as user exec gosu user "$@" else