Skip to content

Commit d00afea

Browse files
add devcontainer
1 parent 0d8a35d commit d00afea

File tree

8 files changed

+145
-0
lines changed

8 files changed

+145
-0
lines changed

.devcontainer/Dockerfile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
FROM ubuntu:22.04
2+
3+
# Versions
4+
ENV CONAN_VERSION=2.4.0
5+
ENV CMAKE_VERSION=3.28.4
6+
7+
# To make it easier for build and release pipelines to run apt-get,
8+
# configure apt to not require confirmation (assume the -y argument by default)
9+
ENV DEBIAN_FRONTEND=noninteractive
10+
RUN echo "APT::Get::Assume-Yes "true";" > /etc/apt/apt.conf.d/90assumeyes
11+
12+
RUN apt-get update
13+
14+
RUN apt-get install -y \
15+
vim clang-format rsync gdb gdbserver x11-apps xauth iproute2 build-essential
16+
RUN apt-get install -y libgtk-3-dev ninja-build
17+
ENV PATH="/opt/cmake/bin:${PATH}"
18+
RUN apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-base \
19+
gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools gstreamer1.0-x \
20+
gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio
21+
RUN apt-get install avahi-utils htop make
22+
23+
# GCC
24+
RUN apt -y install gcc-12 g++-12
25+
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100
26+
RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 100
27+
RUN apt-get autoremove
28+
29+
30+
COPY scripts /opt/nmos/scripts
31+
RUN /bin/bash /opt/nmos/scripts/build-tools/add-user-nmos.sh
32+
RUN /bin/bash /opt/nmos/scripts/build-tools/install-fish.sh
33+
RUN /opt/nmos/scripts/build-tools/install-git.sh
34+
RUN /opt/nmos/scripts/build-tools/install-conan.sh
35+
RUN /opt/nmos/scripts/build-tools/install-cmake-x86.sh

.devcontainer/devcontainer.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "OSSRF - Docker in Docker",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"args": {}
6+
},
7+
"features": {
8+
"ghcr.io/devcontainers/features/docker-in-docker:2": {
9+
"version": "latest",
10+
"enableNonRootDocker": "true",
11+
"moby": "true"
12+
},
13+
"ghcr.io/meaningful-ooo/devcontainer-features/fish:1": {}
14+
},
15+
"customizations": {
16+
"vscode": {
17+
"extensions": []
18+
}
19+
},
20+
"mounts": [
21+
// "source=/usr/share/egl,target=/usr/share/egl,type=bind,consistency=cached",
22+
// "source=/usr/share/nvidia,target=/usr/share/nvidia,type=bind,consistency=cached",
23+
// "source=/usr/share/vulkan,target=/usr/share/vulkan,type=bind,consistency=cached",
24+
// "source=/run/user/1000/pulse/native,target=/run/user/1000/pulse/native,type=bind,consistency=cached",
25+
// "source=${localEnv:HOME}/.config/pulse,target=/home/vscode/.config/pulse,type=bind,consistency=cached",
26+
// "source=/mnt/media-vault,target=/mnt/media-vault,type=bind,consistency=cached"
27+
],
28+
"runArgs": [
29+
"--network=host",
30+
// "--gpus=all",
31+
"--privileged"
32+
],
33+
"containerEnv": {
34+
"PULSE_SERVER": "/run/user/1000/pulse/native"
35+
}
36+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
set -eu
3+
4+
export DEBIAN_FRONTEND=noninteractive
5+
apt-get install -y sudo --option=Dpkg::Options::=--force-confdef
6+
7+
adduser --disabled-password --gecos '' nmos
8+
adduser nmos sudo
9+
echo 'nmos:nmos' | chpasswd
10+
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >>/etc/sudoers
11+
12+
# access gst video plugins as non-root
13+
usermod -aG video nmos
14+
usermod -aG audio nmos
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
set -eu
3+
4+
if [[ -z "${CMAKE_VERSION+x}" ]]; then
5+
echo ">>> ERROR: CMAKE_VERSION must be defined"
6+
exit 1
7+
fi
8+
9+
apt-get update -y && apt-get install -y \
10+
wget \
11+
curl
12+
13+
apt-get remove cmake
14+
15+
cd /tmp
16+
wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh
17+
mkdir /opt/cmake
18+
cp cmake-${CMAKE_VERSION}-linux-x86_64.sh /opt/cmake
19+
cd /opt/cmake
20+
chmod +x cmake-${CMAKE_VERSION}-linux-x86_64.sh
21+
./cmake-${CMAKE_VERSION}-linux-x86_64.sh --skip-license
22+
echo export PATH="/opt/cmake/bin/:${PATH}" >>/etc/profile.d/100-cmake.sh
23+
24+
cd /tmp
25+
rm cmake-${CMAKE_VERSION}-linux-x86_64.sh
26+
cd /
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
set -eu
4+
5+
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
6+
7+
source ${SCRIPT_DIR}/../common/env.sh
8+
9+
check_env_var CONAN_VERSION
10+
11+
apt-get update -y && apt-get install -y --no-install-recommends \
12+
software-properties-common \
13+
python3 \
14+
python3-pip \
15+
python3-setuptools \
16+
python3-wheel
17+
18+
# CONAN
19+
pip3 install --upgrade pip
20+
pip3 install setuptools
21+
pip3 install conan==${CONAN_VERSION} --upgrade
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
set -eu
2+
3+
apt-get update && apt-get install fish
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
set -eu
2+
3+
apt-get update && apt-get install git
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
check_env_var() {
2+
local name=$1
3+
if [[ -z "${!name+x}" ]]; then
4+
echo ">>> ERROR: ${name} must be defined"
5+
exit 1
6+
fi
7+
}

0 commit comments

Comments
 (0)