Good news. The answer is no, this works as expected using the official ghost docker image as I configured it.
My configuration:
edit docker compose file
ghost:latest container:
“Id”: “sha256:a6836f379cf3fff383d58f1d65a4ca2ae6a29945b530d1456875ceee462b77af”
"NODE_VERSION=18.20.0",
"YARN_VERSION=1.22.19",
"GOSU_VERSION=1.16",
"NODE_ENV=production",
"GHOST_CLI_VERSION=1.26.0",
"GHOST_INSTALL=/var/lib/ghost",
"GHOST_CONTENT=/var/lib/ghost/content",
"GHOST_VERSION=5.81.1"
modified mariadb
I am using a Raspberry Pi 4b as a server, which is an arm 7 machine. Mariadb doesn’t post official docker containers for that architecture, so I modified the docker compose file to use this instead:
image: yobasystems/alpine-mariadb:latest
#image: mariadb:latest
#platform: linux/arm64
platform: linux/arm/v7
Maybe you can use an arm7 version of mysql official, I didn’t look into that, and I don’t know if ghost supports mysql officially or not.
If you don’t have a weirdo cpu architecture like I do, then you don’t need to modify this file to use a different container
volumes
The docker compose file creates a volume on your host where the files will live, essentially they are visible to both the container and the host. With this configuration, your theme work will be persisistent across container restarts. This is important::
volumes:
- /home/ghost/content:/var/lib/ghost/content
make sure ghost runs in dev mode
under Environment for the ghost container, add this line:
NODE_ENV: development
Do not run production servers with this line! If you go to production with this container, be sure to shut down the container, remove or comment out the line, and restart the server.
start docker compose file
#docker compose up -d
clone your theme
I put mine in /home/ghost/themes/mytheme
restart your container
I am using vscode with the docker extension to manage containers. I restart from there so that ghost admin can see my theme, then I activate it.
activate your theme
Do this in the ghost admin as usual
edit your theme and run the npm run dev command in the theme directory
In a different vscode window, using the Remote - SSH extension to open a workspace for the folder home/ghost/themes/mytheme.
Open a terminal with the working directory at home/ghost/themes/mytheme, then
$ npm update (only necessary once)
$ npm run dev (leave this running)
Now you can edit your files and the changes should be reflected in the browser at ip address:2368/rest-of-url