forked from JoeyDeVries/LearnOpenGL
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request JoeyDeVries#107 from arteniioleg/master
Build and run in docker
- Loading branch information
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
** | ||
!Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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} |