docker: enabled gpu support

This commit is contained in:
xuveroleg
2018-04-24 16:57:17 +03:00
parent 4c23c8144f
commit c876c7aec8
2 changed files with 12 additions and 4 deletions

View File

@@ -5,8 +5,9 @@ ARG TINI_VERSION='0.18.0'
RUN apt-get update \ RUN apt-get update \
&& apt-get install -y \ && apt-get install -y \
libgtk2.0-0 libcanberra-gtk-module libxext-dev libxrender-dev libxtst-dev libxslt-dev dmz-cursor-theme \ libgtk2.0-0 libcanberra-gtk-module libxext-dev libxrender-dev libxtst-dev libxslt-dev dmz-cursor-theme \
build-essential cmake git wget htop zip unzip nano \ build-essential cmake git \
&& apt-get clean && rm -rf /var/lib/apt/lists/* 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 ADD https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini /tini
RUN chmod +x /tini RUN chmod +x /tini

View File

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