Add DockerBuild.sh and DockerRun.sh helper scripts

This commit is contained in:
Cal Heldenbrand 2023-02-23 10:40:59 -06:00 committed by Lane.Wei
parent 36e2179adc
commit a664128714
2 changed files with 38 additions and 0 deletions

15
DockerBuild.sh Executable file
View file

@ -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

23
DockerRun.sh Executable file
View file

@ -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 $*