I am following this toturial to create a development environment for casper and docker Ghost & Docker : Mon environnement de développement !
I have two repository:
I usually clone both in different directories and do a symlink so it’s available in my work space, this work great.
I am able to edit the forked casper theme and have the change by pressing F5.
I now want within the CI to create a docker image using a custom
Dockerfile where I’ll add the theme in it.
Perhaps the idea is bad, how would you recommend to do that?
I have a Similar issue, I have a theme that is being pushed into my docker container, and it appears on the list so you can click and activate it, I would like to skip that step.
To set the active theme modify theme.active_theme in core/server/data/schema/default-settings.json
There’s all sorts of goodies to set there so I made a modified version and added a COPY statement to my Dockerfile that overwrites the existing one.
This is the complete solution for those wondering:
# Copy theme files
COPY dist/$NAME.zip /var/lib/ghost/content.orig/themes/$NAME.zip
RUN cd /var/lib/ghost/content.orig/themes && \
unzip $NAME.zip -d $NAME && rm -rf $NAME.zip && \
# Set theme to active
(sed -i "s/casper/$NAME/" /var/lib/ghost/versions/$GHOST_VERSION/core/server/data/schema/default-settings.json || sed -i "s/casper/$NAME/" /var/lib/ghost/versions/$GHOST_VERSION/core/server/data/schema/default-settings/default-settings.json) && \
# Install routes.yaml
mv ./$NAME/routes.yaml ../settings/routes.yaml
That last line is a little extra, my theme also defines custom routing.
If you see two
sed commands, it’s because some versions have the default-settings.json in a different location; both are included as a failsafe.
A very nice side-effect of this is that if you’re running Ghost on Docker/K8s and you have the S3 adapter installed, you don’t need a persistent volume anymore