-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce Dockerfile for Ubuntu 24.04
Update others to build and install visp as normal user instead of root
- Loading branch information
Showing
6 changed files
with
374 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 \ | ||
|
@@ -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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 \ | ||
|
@@ -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"] |
Oops, something went wrong.