Merge pull request #107 from arteniioleg/master

Build and run in docker
This commit is contained in:
Joey de Vries
2018-04-24 16:14:09 +02:00
committed by GitHub
3 changed files with 50 additions and 0 deletions

2
docker/.dockerignore Normal file
View File

@@ -0,0 +1,2 @@
**
!Dockerfile

17
docker/Dockerfile Normal file
View File

@@ -0,0 +1,17 @@
FROM ubuntu:18.04
ARG TINI_VERSION='0.18.0'
RUN apt-get update \
&& apt-get install -y \
libgtk2.0-0 libcanberra-gtk-module libxext-dev libxrender-dev libxtst-dev libxslt-dev dmz-cursor-theme \
build-essential cmake git \
libglfw3-dev libassimp-dev libxinerama-dev libxcursor-dev mesa-utils mesa-utils-extra \
wget htop zip unzip nano
ADD https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "--"]
CMD ["sleep", "infinity"]

31
docker/ide.sh Executable file
View File

@@ -0,0 +1,31 @@
#!/bin/bash
[ -n "$(which x11docker)" ] \
|| { echo "x11docker is required https://github.com/mviereck/x11docker"; exit 1; }
SCRIPT_DIR=$(dirname $(readlink -f "$0"))
PROJECT_DIR=$(dirname ${SCRIPT_DIR})
CMD=${@}
[ -n "${CMD}" ] \
|| { echo "Command is required"; exit 1; }
IMAGE=learnopengl
[ -n "$(docker images -q --filter=reference="${IMAGE}")" ] \
|| docker build -t ${IMAGE} ${SCRIPT_DIR}
echo "Info about --gpu https://github.com/mviereck/x11docker#dependencies"
x11docker \
--gpu \
--hostdisplay \
--homedir ${HOME} \
--clipboard \
--stdout --stderr \
--cap-default \
--no-init \
--workdir ${PROJECT_DIR} \
-- "--cap-add=SYS_PTRACE" \
${IMAGE} \
${CMD}