Created
October 18, 2022 13:54
-
-
Save danielroedl/7bf809862255d69cb7f36315d2bef769 to your computer and use it in GitHub Desktop.
Docker Ubuntu - For openframeworks
This file contains hidden or 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
version: "3.9" | |
services: | |
of-develop: | |
build: . | |
volumes: | |
- "/tmp/.X11-unix:/tmp/.X11-unix" | |
- "/etc/alsa:/etc/alsa" | |
- "/usr/share/alsa:/usr/share/alsa" | |
- "${HOME}/.config/pulse:/.config/pulse" | |
- "/run/user/${UID}/pulse/native:/run/user/${UID}/pulse/native" | |
- "$PWD:$PWD" | |
environment: | |
- DISPLAY="$DISPLAY" | |
- PULSE_SERVER="unix:/run/user/$UID/pulse/native" | |
working_dir: "$PWD" | |
user: "${UID}:${UID}" |
This file contains hidden or 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
FROM ubuntu:22.04 | |
# add missing dependencies needed by openframeworks | |
RUN apt-get update -y \ | |
&& \ | |
# tzdata is installed later in install_dependencies script | |
# but with interactive choices, so we configure it here correct | |
DEBIAN_FRONTEND=noninteractive TZ=Europe/Berlin apt-get -y install \ | |
tzdata \ | |
# and also some other depedencies are missing | |
lsb-release \ | |
make \ | |
# and to use sound also we need some more | |
libpulse0 libasound2 libasound2-plugins alsa-base \ | |
&& \ | |
# and clean up the apt cache | |
rm -rf /var/lib/apt/lists/* | |
ARG OF_VERSION=0.11.2 | |
# get openframeworks files and extract to /of | |
ADD https://github.com/openframeworks/openFrameworks/releases/download/${OF_VERSION}/of_v${OF_VERSION}_linux64gcc6_release.tar.gz / | |
RUN cd / && tar -xf of_*.tar.gz && rm of_*.tar.gz && mv of_v* of | |
# install of openframeworks dependencies | |
RUN cd /of/scripts/linux/ubuntu && \ | |
./install_dependencies.sh && \ | |
rm -rf /var/lib/apt/lists/* | |
# Set user and group | |
ARG user=of | |
ARG group=of | |
ARG uid=1000 | |
ARG gid=1000 | |
RUN groupadd -g ${gid} ${group} && \ | |
useradd -u ${uid} -g ${group} -s /bin/sh -m ${user} # <--- the '-m' create a user home directory | |
RUN chown -R ${uid}:${gid} /of | |
# Switch to user | |
USER ${uid}:${gid} | |
# compile openframeworks | |
RUN /of/scripts/linux && \ | |
./compileOF.sh -j3 && \ | |
./compilePG.sh && \ | |
./buildAllExamples.sh | |
WORKDIR /of/examples |
This file contains hidden or 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
#!/bin/bash | |
# build container | |
docker build . --tag ubuntu-of | |
# run container and mount needed sockets and configs | |
docker run -it --rm \ | |
-v /tmp/.X11-unix:/tmp/.X11-unix \ | |
-e DISPLAY=$DISPLAY \ | |
-v /etc/alsa:/etc/alsa \ | |
-v /usr/share/alsa:/usr/share/alsa \ | |
-v $HOME/.config/pulse:/.config/pulse \ | |
-v /run/user/$UID/pulse/native:/run/user/$UID/pulse/native \ | |
-e PULSE_SERVER=unix:/run/user/$UID/pulse/native \ | |
-u $(id -u):$(id -g) \ | |
-v $PWD:$PWD \ | |
-w $PWD \ | |
ubuntu-of |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment