Skip to content

Commit

Permalink
Merge pull request #43 from drug007/add-docker
Browse files Browse the repository at this point in the history
Add a script to build and run sdl example in a docker container
  • Loading branch information
drug007 authored Jan 25, 2024
2 parents 85b50b7 + 4271082 commit 292d47d
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions docker/build-example-sdl-ubuntu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

cd ${SCRIPT_DIR}/..

echo -e "
FROM ubuntu:22.04
RUN apt-get -qq update \
&& apt-get install wget libfreetype-dev libfontconfig-dev libcurl4 gcc libsdl2-2.0-0 libgl1 -qq -y --no-install-recommends --no-install-suggests \
&& mkdir -p /tmp/dmd/ && cd /tmp/dmd \
&& wget -q --no-check-certificate https://downloads.dlang.org/releases/2.x/2.106.1/dmd_2.106.1-0_amd64.deb \
&& dpkg -i /tmp/dmd/dmd_2.106.1-0_amd64.deb \
&& rm -rf /tmp/dmd
" | docker build --network=host -t ubuntu-nanogui -

xhost +local:docker

SCALE=1

if [[ ! -z $1 ]];
then
SCALE=$1
fi

docker run -it --rm \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v $(pwd):/src \
-v $HOME/.dub/:/root/.dub \
-w /src \
--network host \
ubuntu-nanogui \
bash -c "cd /src/examples/sdl/ && dub run -- --scale $SCALE"

0 comments on commit 292d47d

Please sign in to comment.