Rebuilding my docker containers after a small change to my xblock using --no-cache: can I simplify this?

I am writing an xblock for eventual deployment. To do this I have installed openedx via tutor on my local machine. I have my xblock in a git repo. Once I make a change, I need to update the images via:

tutor images build openedx --no-cache

I have to use --no-cache because if I don’t the build process uses a cached version of the xblock’s git repo, which does not reflect the changes. However, this process takes a very long time on my local machine, about 15-20 minutes.

Is there a faster way to do this? Can I just tell it to never use the cached git repo, but use cached everything else?

Hi @mstachow, as per the tutor docs:

Similarly, when developing a custom XBlock, we would like to hot-reload any change we make to the XBlock source code within the containers.
Tutor provides a simple solution to these questions. In both cases, the solution takes the form of a tutor mounts add … command.

You should try to clone your xblock to the machine you have your tutor installation on and then run:

tutor mounts add path-to-your-xblock
tutor images build openedx-dev
tutor dev start -d

After this, your changes to the xblock source code will be hot reloaded in real time. You will not have to rebuild your image again and again.

Note that the mounts will not work if the naming of your xblock repo does not follow these regexes. In which case, you can create a tutor plugin and mount your plugin manually using the MOUNTED_DIRECTORIES filter.

1 Like