Skip to content

Commit

Permalink
Introduce Dockerfile for Ubuntu 24.04
Browse files Browse the repository at this point in the history
Update others to build and install visp as normal user instead of root
  • Loading branch information
fspindle committed Jul 4, 2024
1 parent a19b3c5 commit 65b0ba6
Show file tree
Hide file tree
Showing 6 changed files with 374 additions and 146 deletions.
5 changes: 3 additions & 2 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ViSP 3.x.x (Version in development)
- New features and improvements
. Introduce Python bindings for most of ViSP modules and classes (see corresponding tutorial)
. New specific documentation for Python bindings in https://visp-doc.inria.fr/doxygen/visp-python-daily/
. Updated Dockerfile in ci/docker folder for Ubuntu 18.04, 20.04 and 22.04. Corresponding images are also available
. Updated Dockerfile in docker folder for Ubuntu 18.04, 20.04 and 22.04. Corresponding images are also available
ready to use on DockerHub https://hub.docker.com/repository/docker/vispci/vispci/general
. OpenCV 2.4.8 is the minimal supported version
. Introduce applications in apps folder, a collection of useful tools that
Expand All @@ -38,7 +38,8 @@ ViSP 3.x.x (Version in development)
. New tutorials in tutorial/segmentation/color folder to show how to use HSV color segmentation to
extract the corresponding point cloud
. New scene renderer based on Panda3D. See inheritance diagram for vpPanda3DBaseRenderer class and corresponding
tutorial.
tutorial
. New docker image for Ubuntu 24.04 in docker folder
- Applications
. Migrate eye-to-hand tutorials in apps
- Tutorials
Expand Down
126 changes: 81 additions & 45 deletions ci/docker/ubuntu-18.04/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,50 +1,88 @@
FROM ubuntu:18.04
MAINTAINER Fabien Spindler <[email protected]>

ARG DEBIAN_FRONTEND=noninteractive
ARG VISPCI_USER_UID=1001
ARG DOCKER_GROUP_GID=130
ARG USER_UID=1001
ENV TZ=Europe/Paris

# Update aptitude with new repo
RUN apt-get update
# Update aptitude with default packages
RUN apt-get update \
&& apt-get install -y \
build-essential \
cmake \
cmake-curses-gui \
curl \
gedit \
gdb \
git \
iputils-ping \
locales \
locate \
lsb-release \
mercurial \
nano \
net-tools \
python3 \
python3-dev \
python3-pip \
python3-dbg \
python3-empy \
python3-numpy \
python3-pip \
python3-psutil \
python3-venv \
software-properties-common \
sudo \
tzdata \
vim \
wget \
&& apt-get clean

# Install packages
RUN apt-get install -y \
sudo \
build-essential \
cmake \
git \
net-tools \
iputils-ping \
# Recommended ViSP 3rd parties
libopencv-dev \
libx11-dev \
liblapack-dev \
libeigen3-dev \
libdc1394-22-dev \
libv4l-dev \
libzbar-dev \
libpthread-stubs0-dev \
# Other optional 3rd parties
libpcl-dev \
libcoin80-dev \
libjpeg-dev \
libpng-dev \
libogre-1.9-dev \
libois-dev \
libdmtx-dev \
libgsl-dev
# Update aptitude with recommended ViSP 3rd parties
RUN apt-get update \
&& apt-get install -y \
libdc1394-22-dev \
libeigen3-dev \
liblapack-dev \
libopencv-dev \
libv4l-dev \
libx11-dev \
libzbar-dev \
&& apt-get clean

RUN adduser --disabled-password --gecos "" --uid $VISPCI_USER_UID vispci \
&& groupadd docker --gid $DOCKER_GROUP_GID \
&& usermod -aG sudo vispci \
&& usermod -aG docker vispci \
&& echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers \
&& echo "Defaults env_keep += \"DEBIAN_FRONTEND\"" >> /etc/sudoers \
&& adduser vispci video
# Update aptitude with other optional ViSP 3rd parties
RUN apt-get update \
&& apt-get install -y \
libpcl-dev \
libcoin80-dev \
libjpeg-dev \
libpng-dev \
libogre-1.9-dev \
libois-dev \
libdmtx-dev \
libgsl-dev \
&& apt-get clean

ENV HOME=/home/vispci
# Set Locale
RUN locale-gen en_US en_US.UTF-8 && \
update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 && \
export LANG=en_US.UTF-8

ENV USERNAME vispci

RUN useradd -U --uid $USER_UID -ms /bin/bash ${USERNAME} \
&& echo "${USERNAME}:${USERNAME}" | chpasswd \
&& adduser ${USERNAME} sudo \
&& echo "$USERNAME ALL=NOPASSWD: ALL" >> /etc/sudoers.d/${USERNAME} \
&& adduser ${USERNAME} video

# Commands below are now run as normal user
USER ${USERNAME}

# When running a container start in the home folder
WORKDIR /home/$USERNAME

# Create visp workspace
ENV VISP_WS /home/$USERNAME/visp-ws

# Install visp-images
RUN mkdir -p ${HOME}/visp-ws \
Expand All @@ -54,16 +92,14 @@ RUN mkdir -p ${HOME}/visp-ws \
&& echo "export VISP_INPUT_IMAGE_PATH=${HOME}/visp-ws/visp-images" >> ${HOME}/.bashrc

# Get visp
RUN cd ${HOME}/visp-ws \
RUN cd ${VISP_WS} \
&& git clone https://github.com/lagadic/visp

# Build visp
RUN cd ${HOME}/visp-ws \
RUN cd ${VISP_WS} \
&& mkdir visp-build \
&& cd visp-build \
&& cmake ../visp \
&& make -j4

USER vispci
&& make -j$(nproc)

WORKDIR /home/vispci
CMD ["/bin/bash"]
130 changes: 85 additions & 45 deletions ci/docker/ubuntu-20.04/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,50 +1,92 @@
FROM ubuntu:20.04
MAINTAINER Fabien Spindler <[email protected]>

ARG DEBIAN_FRONTEND=noninteractive
ARG VISPCI_USER_UID=1001
ARG DOCKER_GROUP_GID=130
ARG USER_UID=1001
ENV TZ=Europe/Paris

# Update aptitude with new repo
RUN apt-get update
# Update aptitude with default packages
RUN apt-get update \
&& apt-get install -y \
build-essential \
cmake \
cmake-curses-gui \
curl \
gedit \
gdb \
git \
iputils-ping \
locales \
locate \
lsb-release \
mercurial \
nano \
net-tools \
python3 \
python3-dev \
python3-pip \
python3-dbg \
python3-empy \
python3-numpy \
python3-pip \
python3-psutil \
python3-venv \
software-properties-common \
sudo \
tzdata \
vim \
wget \
&& apt-get clean

# Install packages
RUN apt-get install -y \
sudo \
build-essential \
cmake \
git \
net-tools \
iputils-ping \
# Recommended ViSP 3rd parties
libopencv-dev \
libx11-dev \
liblapack-dev \
libeigen3-dev \
libdc1394-22-dev \
libv4l-dev \
libzbar-dev \
libpthread-stubs0-dev \
# Other optional 3rd parties
libpcl-dev \
libcoin-dev \
libjpeg-dev \
libpng-dev \
libogre-1.9-dev \
libois-dev \
libdmtx-dev \
libgsl-dev
# Update aptitude with recommended ViSP 3rd parties
RUN apt-get update \
&& apt-get install -y \
libdc1394-22-dev \
libeigen3-dev \
liblapack-dev \
libopencv-dev \
libv4l-dev \
libx11-dev \
libzbar-dev \
nlohmann-json3-dev \
&& apt-get clean

RUN adduser --disabled-password --gecos "" --uid $VISPCI_USER_UID vispci \
&& groupadd docker --gid $DOCKER_GROUP_GID \
&& usermod -aG sudo vispci \
&& usermod -aG docker vispci \
&& echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers \
&& echo "Defaults env_keep += \"DEBIAN_FRONTEND\"" >> /etc/sudoers \
&& adduser vispci video
# Update aptitude with other optional ViSP 3rd parties
RUN apt-get update \
&& apt-get install -y \
libcoin-dev \
libdmtx-dev \
libgsl-dev \
libjpeg-dev \
libogre-1.9-dev \
libois-dev \
libpcl-dev \
libpng-dev \
&& apt-get clean

ENV HOME=/home/vispci
# Set Locale
RUN locale-gen en_US en_US.UTF-8 && \
update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 && \
export LANG=en_US.UTF-8

ENV USERNAME vispci

RUN useradd -U --uid $USER_UID -ms /bin/bash ${USERNAME} \
&& echo "${USERNAME}:${USERNAME}" | chpasswd \
&& adduser ${USERNAME} sudo \
&& echo "$USERNAME ALL=NOPASSWD: ALL" >> /etc/sudoers.d/${USERNAME} \
&& adduser ${USERNAME} video

# Commands below are now run as normal user
USER ${USERNAME}

# When running a container start in the home folder
WORKDIR /home/$USERNAME

# Some apps don't show controls without this
ENV QT_X11_NO_MITSHM 1

# Create visp workspace
ENV VISP_WS /home/$USERNAME/visp-ws

# Install visp-images
RUN mkdir -p ${HOME}/visp-ws \
Expand All @@ -54,16 +96,14 @@ RUN mkdir -p ${HOME}/visp-ws \
&& echo "export VISP_INPUT_IMAGE_PATH=${HOME}/visp-ws/visp-images" >> ${HOME}/.bashrc

# Get visp
RUN cd ${HOME}/visp-ws \
RUN cd ${VISP_WS} \
&& git clone https://github.com/lagadic/visp

# Build visp
RUN cd ${HOME}/visp-ws \
RUN cd ${VISP_WS} \
&& mkdir visp-build \
&& cd visp-build \
&& cmake ../visp \
&& make -j4

USER vispci
&& make -j$(nproc)

WORKDIR /home/vispci
CMD ["/bin/bash"]
Loading

0 comments on commit 65b0ba6

Please sign in to comment.