From a6641287144052c2a7041ca5b96f78a15675ec5c Mon Sep 17 00:00:00 2001 From: Cal Heldenbrand Date: Thu, 23 Feb 2023 10:40:59 -0600 Subject: [PATCH] Add DockerBuild.sh and DockerRun.sh helper scripts --- DockerBuild.sh | 15 +++++++++++++++ DockerRun.sh | 23 +++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100755 DockerBuild.sh create mode 100755 DockerRun.sh diff --git a/DockerBuild.sh b/DockerBuild.sh new file mode 100755 index 000000000..3546bf2b8 --- /dev/null +++ b/DockerBuild.sh @@ -0,0 +1,15 @@ +#!/bin/bash +PROJECT_ROOT=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)") + +set -x + +# Wishlist hint: For developers, creating a Docker Compose +# setup with persistent volumes for the build & deps directories +# would speed up recompile times significantly. For end users, +# the simplicity of a single Docker image and a one-time compilation +# seems better. +docker build -t bambustudio \ + --build-arg USER=$USER \ + --build-arg UID=$(id -u) \ + --build-arg GID=$(id -g) \ + $PROJECT_ROOT diff --git a/DockerRun.sh b/DockerRun.sh new file mode 100755 index 000000000..30fd215b8 --- /dev/null +++ b/DockerRun.sh @@ -0,0 +1,23 @@ +#!/bin/bash +set -x +# Just in case, here's some other things that might help: +# Force the container's hostname to be the same as your workstation +# -h $HOSTNAME \ +# just give it all privileges if there's a wierd error +# --privileged=true \ +# If there's problems with the X display, try this +# -v /tmp/.X11-unix:/tmp/.X11-unix \ +docker run \ + `# Use the hosts networking. Printer wifi and also dbus communication` \ + --net=host \ + `# Run as your workstations username to keep permissions the same` \ + -u $USER \ + `# Bind mount your home directory into the container for loading/saving files` \ + -v $HOME:/home/$USER \ + `# Pass the X display number to the container` \ + -e DISPLAY=$DISPLAY \ + `# Attach tty for running bambu with command line things` \ + -ti \ + `# Pass all parameters from this script to the bambu ENTRYPOINT binary` \ + bambustudio $* +