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:
FROM ghost:alpine
ARG NAME
# 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