From 06d4426389c4546a3233d7688bcfca09fe334c34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20Bonveh=C3=AD?= Date: Thu, 30 Jan 2020 13:24:15 -0300 Subject: [PATCH] Add utils/docker with sample dockerfiles - Dockerfile.make builds notion inside an ubuntu image (notion tag) - Dockerfile.run inherits make and installs notion (notion-run tag) setting the entrypoint to it. - docker-bash.sh builds/starts a notion container and drops into a bash prompt, you can run make test for example. - docker-xephyr.sh starts a notion-run container which expects to connect to DISPLAY=1.0 by default, you can use start-xephyr.sh before to test inside it. --- utils/docker/Dockerfile.make | 43 +++++++++++++++++++++++++++++++++++ utils/docker/Dockerfile.run | 5 ++++ utils/docker/docker-bash.sh | 12 ++++++++++ utils/docker/docker-xephyr.sh | 13 +++++++++++ utils/docker/start-xephyr.sh | 1 + 5 files changed, 74 insertions(+) create mode 100644 utils/docker/Dockerfile.make create mode 100644 utils/docker/Dockerfile.run create mode 100755 utils/docker/docker-bash.sh create mode 100755 utils/docker/docker-xephyr.sh create mode 120000 utils/docker/start-xephyr.sh diff --git a/utils/docker/Dockerfile.make b/utils/docker/Dockerfile.make new file mode 100644 index 000000000..56b47c530 --- /dev/null +++ b/utils/docker/Dockerfile.make @@ -0,0 +1,43 @@ +# http://blog.csicar.de/docker/window-manger/2016/05/24/docker-wm.html + +# Xephyr :1 -ac -br -screen 1024x768 -resizeable -reset +# Xephyr :1 -ac -br -screen 1024x768 -screen 1024x768 +xinerama +extension RANDR -resizeable -reset +# Xephyr :1 -ac -br -screen 1024x768 -screen 1024x768 +extension RANDR -resizeable -reset + +# docker build -f ../Dockerfile.notion . -t notion && docker run --rm -it -e DISPLAY=:1 --name notion-test -v /tmp/.X11-unix:/tmp/.X11-unix notion +# docker build -f ../Dockerfile.notion . -t notion && docker run --rm -it -e DISPLAY=:1 --name notion-test -v /tmp/.X11-unix:/tmp/.X11-unix --entrypoint /bin/bash notion +# docker exec -it `docker ps --filter "name=notion-test" -q` /bin/bash + +FROM ubuntu:18.04 + +ENV DEBIAN_FRONTEND=noninteractive +RUN echo 'Acquire::http { Proxy "http://172.17.0.1:3142"; };' >> /etc/apt/apt.conf.d/01proxy +RUN apt update && apt install -y pkg-config build-essential groff + +RUN apt update && apt install -y libx11-dev libxext-dev libsm-dev libxft-dev libxinerama-dev libxrandr-dev gettext x11-utils \ + xterm x11-xserver-utils wget unzip xserver-xorg-video-dummy + +# RUN apt update && apt install -y lua5.1 liblua5.1-dev +RUN apt update && apt install -y lua5.2 liblua5.2-dev +# RUN apt update && apt install -y lua5.3 liblua5.3-dev + +# https://bugs.launchpad.net/ubuntu/+source/lua-posix/+bug/1752082 +RUN apt update && apt install -y lua-posix \ + && ln -s /usr/lib/x86_64-linux-gnu/lua/5.2/posix_c.so /usr/lib/x86_64-linux-gnu/lua/5.2/posix.so + +# If lua-posix package is not available, use luarocks +# RUN wget https://luarocks.org/releases/luarocks-3.0.4.tar.gz \ +# && tar zxpf luarocks-3.0.4.tar.gz \ +# && cd luarocks-3.0.4 \ +# && ./configure \ +# && make build && make install +# RUN luarocks install luaposix + +# Icon branch +# RUN apt update && apt install -y libcairo2-dev + +RUN mkdir /notion +WORKDIR /notion +COPY . /notion/ +RUN make +ENTRYPOINT ["/bin/bash"] diff --git a/utils/docker/Dockerfile.run b/utils/docker/Dockerfile.run new file mode 100644 index 000000000..b1eb10aec --- /dev/null +++ b/utils/docker/Dockerfile.run @@ -0,0 +1,5 @@ +FROM notion + +ENV DISPLAY=${NOTION_TEST_DISPLAY:-:1.0} +RUN make install +ENTRYPOINT ["/usr/local/bin/notion"] diff --git a/utils/docker/docker-bash.sh b/utils/docker/docker-bash.sh new file mode 100755 index 000000000..b4813d6f9 --- /dev/null +++ b/utils/docker/docker-bash.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -e + +this_rel=$(dirname ${BASH_SOURCE[0]}) +rel_root=$this_rel/../.. + +notion_root=$(realpath $rel_root) + +docker build -f Dockerfile.make -t notion $notion_root +docker run --rm -it --name notion-test -v /tmp/.X11-unix:/tmp/.X11-unix notion + diff --git a/utils/docker/docker-xephyr.sh b/utils/docker/docker-xephyr.sh new file mode 100755 index 000000000..8157b3738 --- /dev/null +++ b/utils/docker/docker-xephyr.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -e + +this_rel=$(dirname ${BASH_SOURCE[0]}) +rel_root=$this_rel/../.. + +notion_root=$(realpath $rel_root) + +docker build -f Dockerfile.make -t notion $notion_root +docker build -f Dockerfile.run -t notion-run $notion_root +docker run --rm -it --name notion-test -v /tmp/.X11-unix:/tmp/.X11-unix notion-run + diff --git a/utils/docker/start-xephyr.sh b/utils/docker/start-xephyr.sh new file mode 120000 index 000000000..7606e30e1 --- /dev/null +++ b/utils/docker/start-xephyr.sh @@ -0,0 +1 @@ +../xephyr/start-xephyr.sh \ No newline at end of file