-
Notifications
You must be signed in to change notification settings - Fork 7
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 #43 from drug007/add-docker
Add a script to build and run sdl example in a docker container
- Loading branch information
Showing
1 changed file
with
35 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,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" |