After spending a few hours this morning realizing the official ghost image doesn't support development mode correctly, I had to slightly modify it using docker-compose. If you're making a ghost theme and need an instant way to spin up an instance that syncs your theme over as you edit it, here it is:
docker-compose.yml next to your
version: '3' services: blog: image: ghost:1.14.1 ports: - 2368:2368 volumes: - ./theme:/var/lib/ghost/content/themes/casper environment: - NODE_ENV=development command: > bash -c "cp config.production.json config.development.json && bash /usr/local/bin/docker-entrypoint.sh node current/index.js"
docker-compose up. Now your theme is activated and you can start editing it! It's that simple to do if you're using Docker. Took me hours to realize this because I had to read through their Dockerfile and understand how ghost reads its config.
Why this is needed
If you simply run the official ghost image, it defaults to production. Your active theme will not live update as it is cached. If you switch the env to development, the site will not load. The team at ghost must think nobody would use their image in development.... This is because their config file is named
config.production.json. If they would have named it
config.js (I think) or just added a duplicate version of it for dev, everything would work with the env flag. Overriding this meant manually running their entrypoint command which was a little confusing too. Lastly, I copied the folder direct to the default theme directory so that you don't have to create an account just to activate your theme.
Hopefully this gets fixed, I opened an issue on the ghost github linking to this.