leibylucw / dock-press

A project to Dockerize a WordPress site
0 stars 0 forks source link

Plan for themes #8

Open leibylucw opened 4 months ago

leibylucw commented 4 months ago

Similar to #7, I need to figure out how themes should be installed. One could tarball their themes directory and extract the contents to their Dockerized setup, but I need to plan for how dock-press handles this.

leibylucw commented 4 months ago

Current Plan

The current plan, as executed by #17 and #22 is as follows:

Mount Theme Directory to WordPress Container

The Docker compose.yml file mounts wp-content/themes/<theme-directory> to the WordPress container at the path wp-content/themes/<theme-directory>. This allows for the user to develop their theme locally and observe the changes without needing to copy modified files to the container every time changes are made.

Additional Planning

This one is non-obvious. Here are some preliminary questions to answer before doing any work:

  1. What happens if the user doesn't have a custom theme?
  2. What if the user has multiple custom themes?
  3. What if they want to install a new theme to test/preview using dock-press and subsequently need to install it on their hosted site?
    1. How will dock-press know which theme to export?
    2. Should it be exported like uploads and plugins?
    3. Should dock-press just mount the entire wp-content/themes directory and call it a day?

Another way to improve on this workflow is to have a composer project to manage themes. This is tracked by #3 and #4.

leibylucw commented 4 months ago

29 addresses the above concern by using a bind mount from wp-content/themes locally to wp-content/themes on the WordPress container using the read-only flag. This means the container will be able to read contents placed in the local filesystem's wp-contents/themes, but not write to it. So, whatever content exists on the local filesystem will also persist in the container, but not vice versa. That is to say, the stock WordPress themes will not sync to the local filesystem.