Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docker-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sudo docker build -t x1plus scripts/docker/
4 changes: 4 additions & 0 deletions docker-clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sudo docker stop x1plus
sudo docker container rm x1plus
sudo docker image rm x1plus
sudo docker buildx prune -f
1 change: 1 addition & 0 deletions docker-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sudo docker run --name x1plus -it -v `pwd`:/work x1plus
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we have users run the prebuilt docker image instead of building it themselves? then we know they'll get the same thing we have in CI

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say yes, a prebuilt image is preferred - not everyone might have a powerful machine on hand to build the base image fast.

I'd probably also commit the /work directory into the image so that no git checkout is necessary for basic work/build. That way it's an atomic, "guaranteed to work" image.

Another note I'd add here is running the container in detached mode. With the current commands (especially the ones provided in the README), for each command, a new container is spun up then shut down once the command completes. With a detached container, just by referring to the name and using exec instead of run, a lot of resources can be saved.

For example the current README approach is:

$ docker run -u `id -u` -v `pwd`:/work x1plusbuild bash -c 'git config --global --add safe.directory /work'
$ docker run -u `id -u` -v `pwd`:/work x1plusbuild make scripts
$ scp scripts/getkey root@bambu:/tmp
$ ssh root@bambu /tmp/getkey >> localconfig.mk
$ docker run -u `id -u` -v `pwd`:/work x1plusbuild make

Which could be modified to:

$ docker run -d --name x1plus -u `id -u` -v `pwd`:/work x1plusbuild 
$ docker exec -it x1plus bash -c 'git config --global --add safe.directory /work'
$ docker exec -it x1plus make scripts
$ scp scripts/getkey root@bambu:/tmp
$ ssh root@bambu /tmp/getkey >> localconfig.mk
$ docker exec -it x1plus make
$ docker stop x1plus
// Later on, the same container can be spun up with
$ docker start x1plus