Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial implementation of docker images for both user and developers #12

Merged
merged 3 commits into from
Mar 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions misc/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# common
from ubuntu:latest
copy build-common.sh /build-common.sh
run /bin/bash -xe /build-common.sh
run /bin/rm -f /build-common.sh
20 changes: 20 additions & 0 deletions misc/docker/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.PHONY: all
all: dev user
build: common dev user

common: Dockerfile build-common.sh
docker build -t brlcad-common:latest .

dev: dev/Dockerfile dev/build-dev.sh common
docker build -t brlcad-dev:latest dev

user: user/Dockerfile user/build-user.sh common
docker build -t brlcad-user:latest user

.PHONY: tag push
tag:
docker tag brlcad-user:latest erikgreenwald/brl-cad:latest
docker tag brlcad-dev:latest erikgreenwald/brl-cad-dev:latest
push: tag
docker push erikgreenwald/brl-cad:latest
docker push erikgreenwald/brl-cad-dev:latest
7 changes: 7 additions & 0 deletions misc/docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Docker images for BRL-CAD development

This starts up both the developer and user images. Instructions for each (as well as how to launch independantly) are in the subdirs.

start with:
make all
docker-compose -p brlcad up -d --build
7 changes: 7 additions & 0 deletions misc/docker/build-common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apt-get -q update -y
apt-get -q dist-upgrade -y
useradd -rm -d /home/cadling -s /bin/bash -g root -u 1001 cadling
echo root:brlcad | chpasswd
echo cadling:brlcad | chpasswd
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -qy install tzdata openssh-server xauth libopengl0 tk libqt5widgets5 libpng16-16
service ssh start
9 changes: 9 additions & 0 deletions misc/docker/dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# common
from brlcad-common:latest

copy build-dev.sh /build-dev.sh
copy /startup /startup
run /bin/bash -xe /build-dev.sh
run /bin/rm -f /build-dev.sh

cmd ["/bin/bash","-x","/startup"]
19 changes: 19 additions & 0 deletions misc/docker/dev/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Docker image for BRL-CAD development

start with:
make all
docker-compose -p brlcad up -d --build

opens ssh on port 4322. Source is checked out to /brlcad and obj dir configured in /brlcad/build.

User: cadling
User password: brlcad
Root password: brlcad

from the vs code remote extension:

ssh -ACX -l cadling -p 4322 localhost

then install various extensions, like cmake, c++, doxygen, etc.

For other user cases, it might be better to mount a local fs (volume to dir in docker-compose.yaml) or NFS mount and have a user with the appropriate uid.
10 changes: 10 additions & 0 deletions misc/docker/dev/build-dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get -qy install cmake git build-essential ninja-build swig doxygen libpng-dev libgl1-mesa-dev libopenmpi-dev libqt5opengl5-dev libeigen3-dev itk3-dev time npm
npm install -g @antora/cli @antora/site-generator-default
npm install -g antora-site-generator-lunr

mkdir -m 755 /brlcad
chown -R cadling /brlcad
chmod 555 /startup

su cadling -c '/usr/bin/time -v /usr/bin/git clone https://github.com/BRL-CAD/brlcad.git /brlcad'
su cadling -c '/usr/bin/time -v /usr/bin/cmake -G Ninja -S /brlcad/ -B /brlcad/build/ -DBRLCAD_ENABLE_QT=ON'
11 changes: 11 additions & 0 deletions misc/docker/dev/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: "3"
services:
dev:
build: .
environment:
- DISPLAY=${DISPLAY}
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix
ports:
- "4301:5901"
- "4322:22"
2 changes: 2 additions & 0 deletions misc/docker/dev/startup
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
/usr/sbin/sshd -Dd
20 changes: 20 additions & 0 deletions misc/docker/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: "3"
services:
dev:
build: dev
environment:
- DISPLAY=${DISPLAY}
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix
ports:
- "4301:5901"
- "4322:22"
user:
build: user
environment:
- DISPLAY=${DISPLAY}
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix
ports:
- "4201:5901"
- "4222:22"
12 changes: 12 additions & 0 deletions misc/docker/user/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# common
from brlcad-common:latest

# BRL-CAD
copy BRL-CAD_7.32.5_Linux_x86_64.tar.gz /BRL-CAD_7.32.5_Linux_x86_64.tar.gz
copy build-user.sh /build-user.sh
copy startup /startup
copy xinit /xinit
run /bin/bash -xe /build-user.sh
run /bin/rm -f /build-user.sh /BRL-CAD_7.32.5_Linux_x86_64.tar.gz

cmd ["/bin/sh", "-x", "/startup"]
21 changes: 21 additions & 0 deletions misc/docker/user/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Docker image for BRL-CAD

You will need to furnish BRL-CAD\_7.32.5\_Linux\_x86.tar.gz yourself. Place it in this directory before building the docker images.

start with:
make all
docker-compose -p brlcad up -d --build

BRL-CAD is installed in /opt/brlcad and the path is pre-configured.

Starts a VNC server listening on port 4201 with Archer running.


also opens ssh on port 4222.

* User: cadling
* User password: brlcad
* Root password: brlcad


this little guide should probably be super user friendly instead of what it is.
14 changes: 14 additions & 0 deletions misc/docker/user/build-user.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -qy install openbox menu tigervnc-standalone-server
echo 'export PATH=$PATH:/opt/brlcad/bin' >> /etc/bash.bashrc
chmod 555 /startup /xinit
su cadling -c 'touch /home/cadling/.Xauthority'
su cadling -c 'mkdir /home/cadling/.vnc/'
su cadling -c 'echo brlcad | vncpasswd -f > /home/cadling/.vnc/passwd'
su cadling -c 'chmod 600 /home/cadling/.vnc/passwd'
mkdir -p /opt/brlcad/
ln -s /opt/brlcad/BRL-CAD_7.32.5_$(uname -s)_$(uname -m)/bin /opt/brlcad/
ln -s /opt/brlcad/BRL-CAD_7.32.5_$(uname -s)_$(uname -m)/include /opt/brlcad/
ln -s /opt/brlcad/BRL-CAD_7.32.5_$(uname -s)_$(uname -m)/libexec /opt/brlcad/
ln -s /opt/brlcad/BRL-CAD_7.32.5_$(uname -s)_$(uname -m)/lib /opt/brlcad/
ln -s /opt/brlcad/BRL-CAD_7.32.5_$(uname -s)_$(uname -m)/share /opt/brlcad/
tar -zxf BRL-CAD_7.32.5_Linux_x86_64.tar.gz -C /opt/brlcad/

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I notice that the release number 7.32.5 is hard-coded everywhere.
Maybe it should be parameterized somehow.

11 changes: 11 additions & 0 deletions misc/docker/user/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: "3"
services:
user:
build: .
environment:
- DISPLAY=${DISPLAY}
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix
ports:
- "4201:5901"
- "4222:22"
3 changes: 3 additions & 0 deletions misc/docker/user/startup
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
su - cadling -c "/usr/bin/tigervncserver -fg -localhost no -geometry 1200x600 -xstartup /xinit" &
/usr/sbin/sshd -Dd
6 changes: 6 additions & 0 deletions misc/docker/user/xinit
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
/usr/bin/openbox-session &
PID=$!
/opt/brlcad/bin/archer &
/usr/bin/xterm &
wait $PID