Skip to content

Commit a664128

Browse files
calhlanewei120
authored andcommitted
Add DockerBuild.sh and DockerRun.sh helper scripts
1 parent 36e2179 commit a664128

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

DockerBuild.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
PROJECT_ROOT=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
3+
4+
set -x
5+
6+
# Wishlist hint: For developers, creating a Docker Compose
7+
# setup with persistent volumes for the build & deps directories
8+
# would speed up recompile times significantly. For end users,
9+
# the simplicity of a single Docker image and a one-time compilation
10+
# seems better.
11+
docker build -t bambustudio \
12+
--build-arg USER=$USER \
13+
--build-arg UID=$(id -u) \
14+
--build-arg GID=$(id -g) \
15+
$PROJECT_ROOT

DockerRun.sh

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
set -x
3+
# Just in case, here's some other things that might help:
4+
# Force the container's hostname to be the same as your workstation
5+
# -h $HOSTNAME \
6+
# just give it all privileges if there's a wierd error
7+
# --privileged=true \
8+
# If there's problems with the X display, try this
9+
# -v /tmp/.X11-unix:/tmp/.X11-unix \
10+
docker run \
11+
`# Use the hosts networking. Printer wifi and also dbus communication` \
12+
--net=host \
13+
`# Run as your workstations username to keep permissions the same` \
14+
-u $USER \
15+
`# Bind mount your home directory into the container for loading/saving files` \
16+
-v $HOME:/home/$USER \
17+
`# Pass the X display number to the container` \
18+
-e DISPLAY=$DISPLAY \
19+
`# Attach tty for running bambu with command line things` \
20+
-ti \
21+
`# Pass all parameters from this script to the bambu ENTRYPOINT binary` \
22+
bambustudio $*
23+

0 commit comments

Comments
 (0)