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

Build and run in docker #107

Merged
merged 3 commits into from Apr 24, 2018
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions docker/.dockerignore
@@ -0,0 +1,2 @@
**
!Dockerfile
17 changes: 17 additions & 0 deletions docker/Dockerfile
@@ -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 changes: 31 additions & 0 deletions docker/ide.sh
@@ -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}