Ghost on Docker + Cloudinary Storage Adapter

Currently, my blog is running Ghost CLI + Ghost Storage Cloudinary, it is working smoothly with my workflow.
After I learnt about deploy on Docker, it really something I want on my server for my website. Thanks Ghost official built-in a lot of GUI features for import and export the content and members, it’ s really easy for someone like me to do it without any deployment experience it can be easily deploy in Docker-compose.yml below.

version: '3.1'


    image: ghost:4-alpine
    restart: always
      - 8080:2368
      # see
      database__client: mysql
      database__connection__host: db
      database__connection__user: root
      database__connection__password: example
      database__connection__database: ghost
      # this url value is just an example, and is likely wrong for your environment!
      url: http://localhost:8080
      # contrary to the default mentioned in the linked documentation, this image defaults to NODE_ENV=production (so development mode needs to be explicitly specified if desired)
      #NODE_ENV: development

    image: mysql:8.0
    restart: always
      MYSQL_ROOT_PASSWORD: example

However, I have totally have no idea what should I do for Ghost Storage Cloudinary plugin, Install on Docker section, does it mean that I have to do it in ghost container directory after I deployed Ghost container?

FROM ghost:5-alpine as cloudinary
RUN apk add g++ make python3
RUN su-exec node yarn add ghost-storage-cloudinary

FROM ghost:5-alpine
COPY --chown=node:node --from=cloudinary $GHOST_INSTALL/node_modules $GHOST_INSTALL/node_modules
COPY --chown=node:node --from=cloudinary $GHOST_INSTALL/node_modules/ghost-storage-cloudinary $GHOST_INSTALL/content/adapters/storage/ghost-storage-cloudinary
# Here, we use the Ghost CLI to set some pre-defined values.
RUN set -ex; \
    su-exec node ghost config ghost-storage-cloudinary; \
    su-exec node ghost config storage.ghost-storage-cloudinary.upload.use_filename true; \
    su-exec node ghost config storage.ghost-storage-cloudinary.upload.unique_filename false; \
    su-exec node ghost config storage.ghost-storage-cloudinary.upload.overwrite false; \
    su-exec node ghost config storage.ghost-storage-cloudinary.fetch.quality auto; \
    su-exec node ghost config storage.ghost-storage-cloudinary.fetch.cdn_subdomain true;

You have the generally right idea:

You have to create a new Docker container that includes the Cloudinary customizations, and then a modified docker-compose.yml file that references your modified container.

And then every time there’s a new Ghost release, you’ll have some extra work to do: Rebuild your own image again, and update your docker compose file again.

Are the benefits of Docker worth the extra steps? If Ghost is the only thing running on your server, or nothing else on the server needs Node.js or MySQL, maybe it’s easier just to keep using the CLI version.

If you have a more complex situation where other apps could use conflicting Node.js or MySQL versions then using Docker to isolate them could be the way to go.

Thanks for the suggestion, looks like it is really complex for me :sweat_smile: . Looks like using the default docker image without Cludinary Storage Adapter is the better option for me for now.

Because My VPS right now actually is quite a number of services running in docked and managed in Ngnix Proxy Manager, and I don’t think Ghost CLI works without Ngnix.

Here are the specific stages of ghost setup you can run:

ghost setup --help
ghost setup [stages…]
stages can be one or more of nginx, ssl, mysql, systemd, migrate, linux-user.

So it’s possible to run the other stages without running the Nginx and SSL stages, if you want Nginx Proxy Manager to handle those for you.

The Nginx config that the CLI would setup is a pretty basic proxy setup, like what I imagine Nginx Proxy Manager would setup.

The port number that Nginx Proxy Manager would need to forward to is found in the config.production.json file in the root directory where the site is installed.

Thanks for giving me an idea, I haven’t tried but looks like I am able to skip the NGNIX setup while ghost CLI setup is the option, then use Ngnix Proxy Manager to manage it. Hopefully, it works :grinning:.

Set up NGINX? (Recommended) - skip

If it doesn’t work, I could follow the links below.

I have installed Ghost CLI successfully, but for some reason, it looks like I couldn’t access it from browser on, never encountered the same problem on my docker container, so I believe due to some setup on my server.

FYI: NGNIX is not installed, because I would like to try access from an IP port.

End up I used docker-compose for ghost deployment and Ngnix Proxy Manager without Cloudinary Storage Adapter.

For some reasons, I encountered an error when building docker.file, in case anyone needed may refer to the post: Deploy a Ghost Blog in Production to Koyeb - Koyeb

And Self Hosting a Ghost blog with docker-compose, Mailgun setup, and Stripe subscriptions is for docker-compose tutorial.