forked from ros-drivers/usb_cam
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from ethz-asl/pr-container-readme
Devcontainer + README + learning models / interface
- Loading branch information
Showing
19 changed files
with
737 additions
and
763 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Base Stage: ROS and CUDA Installation | ||
FROM ros:noetic-ros-core AS base | ||
|
||
ARG TZ=Europe/Zurich | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
ENV PATH="${PATH}:/opt/hpcx/ompi/bin" | ||
|
||
# All apt packages | ||
COPY .devcontainer/devcontainer_all_packages.sh /tmp/devcontainer_all_packages.sh | ||
RUN /tmp/devcontainer_all_packages.sh && rm -f /tmp/devcontainer_all_packages.sh | ||
|
||
ENV LANG="en_US.UTF-8" \ | ||
LANGUAGE="en_US:en" \ | ||
LC_ALL="en_US.UTF-8" | ||
|
||
# Add user "asl" with sudo rights | ||
RUN groupadd -r asl && \ | ||
useradd --create-home --gid asl --groups dialout,plugdev --shell /bin/bash asl && \ | ||
mkdir -p /etc/sudoers.d && \ | ||
echo 'asl ALL=NOPASSWD: ALL' > /etc/sudoers.d/asl | ||
|
||
# CUDA: Install | ||
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.1-1_all.deb && \ | ||
sudo dpkg -i cuda-keyring_1.1-1_all.deb && \ | ||
sudo apt update && \ | ||
sudo apt -y install cuda-toolkit-12-6 cudnn9-cuda-12 | ||
|
||
# CUDA: Add PATH and LD_LIBRARY_PATH to .bash_aliases | ||
RUN echo 'export PATH=$PATH:/usr/local/cuda/bin' >> /home/asl/.bash_aliases && \ | ||
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64' >> /home/asl/.bash_aliases | ||
|
||
# TensorRT: Install from .deb file | ||
COPY resources/nv-tensorrt-repo-ubuntu2004-cuda11.6-trt8.4.3.1-ga-20220813_1-1_amd64.deb /tmp/ | ||
RUN sudo dpkg -i /tmp/resources/nv-tensorrt-repo-ubuntu2004-cuda11.6-trt8.4.3.1-ga-20220813_1-1_amd64.deb || sudo apt-get install -f -y | ||
# RUN sudo cp /var/nv-tensorrt-repo-ubuntu2004-cuda11.6-trt8.4.3.1-ga-20220813/*-keyring.gpg /usr/share/keyrings/ && sudo apt update && sudo apt install -y tensorrt | ||
RUN sudo apt update && sudo apt install -y tensorrt | ||
|
||
# OpenCV Build Stage | ||
FROM base AS opencv_build | ||
|
||
# OpenCV 4.10.0 install | ||
COPY .devcontainer/build_opencv.sh /tmp/build_opencv.sh | ||
RUN bash /tmp/build_opencv.sh && rm -rf /tmp/build_opencv.sh | ||
|
||
# Final Stage: Combine ROS, CUDA, and OpenCV | ||
FROM base AS final | ||
|
||
# Copy OpenCV installation from the build stage | ||
COPY --from=opencv_build /usr/local /usr/local | ||
|
||
# Git-prompt: Source | ||
RUN echo 'if [ -f "$HOME/.bash-git-prompt/gitprompt.sh" ]; then GIT_PROMPT_ONLY_IN_REPO=1; source "$HOME/.bash-git-prompt/gitprompt.sh"; fi' >> /home/asl/.bash_aliases | ||
|
||
# ROS: Source | ||
RUN echo "source /opt/ros/noetic/setup.bash" >> /home/asl/.bash_aliases | ||
|
||
# ROS: rosdep install (TODO: maybe not so clean?) | ||
RUN sudo rosdep init | ||
USER asl | ||
RUN rosdep update | ||
COPY package.xml /tmp/ | ||
RUN rosdep install --from-paths /tmp/ --ignore-src -r -y -v | ||
USER root | ||
|
||
# Clean up | ||
RUN rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/* /var/cache/apt/archives/* | ||
ENTRYPOINT ["/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 |
---|---|---|
@@ -0,0 +1 @@ | ||
docker buildx build --tag omavteam/v4l2_camera:latest -f .devcontainer/Dockerfile --push . |
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"image": "omavteam/v4l2_camera:latest", | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"ms-python.python" | ||
], | ||
"settings": { | ||
"files.hotExit": "off", | ||
"window.restoreWindows": "none", | ||
"workbench.startupEditor": "none" | ||
} | ||
} | ||
}, | ||
"remoteEnv": { | ||
"DISPLAY": "${localEnv:DISPLAY}" | ||
}, | ||
"remoteUser": "asl", | ||
"initializeCommand": ".devcontainer/devcontainer_optional_mounts.sh", | ||
"mounts": [ | ||
{ | ||
"source": "${localEnv:HOME}/.bash-git-prompt", | ||
"target": "/home/asl/.bash-git-prompt", | ||
"type": "bind" | ||
}, | ||
{ | ||
"source": "${localEnv:HOME}/.cache", | ||
"target": "/home/asl/.cache", | ||
"type": "bind" | ||
} | ||
], | ||
"runArgs": [ | ||
"--gpus", | ||
"all", | ||
"--privileged", | ||
"--device=/dev/dri:/dev/dri", | ||
"-v", | ||
"/tmp/.X11-unix:/tmp/.X11-unix", | ||
"-v", | ||
"/dev/bus/usb:/dev/bus/usb", | ||
"--net=host" | ||
] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#!/bin/bash | ||
|
||
set -eux | ||
export DEBIAN_FRONTEND=noninteractive | ||
|
||
main() { | ||
local pkgs=( | ||
apt-transport-https | ||
build-essential | ||
ca-certificates | ||
ccache | ||
cmake | ||
curl | ||
gfortran | ||
git | ||
gnupg | ||
htop | ||
libatlas-base-dev | ||
libavcodec-dev | ||
libavformat-dev | ||
libavresample-dev | ||
libcanberra-gtk3-module | ||
libdc1394-22-dev | ||
libeigen3-dev | ||
libglew-dev | ||
libgstreamer-plugins-base1.0-dev | ||
libgstreamer-plugins-good1.0-dev | ||
libgstreamer1.0-dev | ||
libgtk-3-dev | ||
libjpeg-dev | ||
libjpeg-turbo8-dev | ||
libjpeg8-dev | ||
liblapack-dev | ||
liblapacke-dev | ||
libopenblas-dev | ||
libpng-dev | ||
libpostproc-dev | ||
libswscale-dev | ||
libtbb-dev | ||
libtbb2 | ||
libtesseract-dev | ||
libtiff-dev | ||
libv4l-dev | ||
libx264-dev | ||
libxine2-dev | ||
libxvidcore-dev | ||
locales | ||
net-tools | ||
pkg-config | ||
python-dev | ||
python-numpy | ||
python3-dev | ||
python3-matplotlib | ||
python3-numpy | ||
python3-rosdep | ||
qv4l2 | ||
software-properties-common | ||
ssh | ||
sudo | ||
udev | ||
unzip | ||
v4l-utils | ||
vim | ||
wget | ||
zlib1g | ||
zlib1g-dev | ||
) | ||
|
||
apt-get update | ||
apt-get upgrade -y | ||
apt-get -y --quiet --no-install-recommends install "${pkgs[@]}" | ||
|
||
mkdir -p /root/.ssh \ | ||
&& chmod 0700 /root/.ssh \ | ||
&& ssh-keyscan github.com > /root/.ssh/known_hosts | ||
|
||
ln -snf /usr/share/zoneinfo/${TZ} /etc/localtime && echo ${TZ} > /etc/timezone | ||
sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen | ||
locale-gen en_US.UTF-8 | ||
dpkg-reconfigure locales | ||
|
||
apt-get -y autoremove | ||
apt-get clean autoclean | ||
rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/* | ||
} | ||
|
||
main "$@" |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
if [ ! -d "$HOME/.bash-git-prompt" ]; then | ||
mkdir "$HOME/.bash-git-prompt" | ||
fi | ||
|
||
if [ ! -d "$HOME/.cache" ]; then | ||
mkdir "$HOME/.cache" | ||
fi |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.