JavaScript Assets Not Loading After bench build or Update in Dockerized Fullstack Frappe Project

Hi everyone,

I’m building a fullstack application using Frappe, HTMX, and Jinja. All of my static assets (JavaScript, CSS, and images) are stored inside the public directory of my custom app.

However, after running any of the following commands:

  • bench build
  • bench update --build
  • bench migrate
  • bench clear-cache
  • bench clear-website-cache

…the updated JavaScript files don’t seem to be loaded or reflected in the browser. Even after a hard refresh or clearing the browser cache, the old version of the JS file is still used (or sometimes not loaded at all).

I’m deploying this setup using Docker, and this problem persists even after restarting the container.

Things I’ve checked:

  • The files are updated correctly in the public folder.
  • The browser still serves an outdated or cached version.
  • The static URL paths look correct but don’t reflect the latest changes.

Is there something specific I need to do to properly bust the cache or ensure the latest assets are served in a Dockerized Frappe setup?

Any guidance or best practices would be appreciated!

Thanks in advance!

Thanks a lot for the suggestion!
I’ll give it a try and see if it solves the issue. Really appreciate you taking the time to help out :raised_hands:

Have you found the problem? I am experiencing a similar issue.

The key is to stop the containers and recreate them. Use --force-recreate with docker compose up command it will re-create containers with correct assets from image. Something like:

docker compose -p <container-name> -f docker-compose.yml up -d --force-recreate --build --remove-orphans

Like mentioned by @revant_one

https://discuss.frappe.io/t/bench-build-force-404/139746/9?u=coffeeinc

Running bench build in production seems to mess up the assets and require the containers to be recreated. The FAQs also mention avoiding to run this command as the assets come bundled with the image container.

For added measure, you can also run the following command to update permissions of assets folder access:

docker exec -u 0:0 -i <container-name> chmod -R o+rx /home/frappe