Skip to content

Theme development with Docker

Eduardo Gómez edited this page Aug 19, 2022 · 5 revisions

First of all, thank you so much to D3473R for his awesome job on this! He make it possible! 🙌🏼


Development mode

The following steps will guide you so that you can have a development environment on your machine without having to install Ghost:

  1. Install Docker and docker-compose

  2. Install Nodejs and npm

  3. Clone or download this repository

  4. Open a terminal and go to the src directory

  5. Run npm install

  6. Run npm run get-database to get the Ghost database dump

  7. Start Docker

  8. Run npm run docker-watch

IMPORTANT: You probably will need to wait a little bit, even if a browser’s tab is opened, please keep waiting since the whole image and database will be created from scratch, probably it would take a few minutes, this will happen only the first time, the next time it should be faster.

If everything goes well you should see this page:

Screenshot 2022-08-17 at 23-34-57 Setup - Ghost

After you enter your own credentials you still need to activate the theme in the Ghost Admin: Settings —> Design —> Themes —> Advanced

CleanShot 2022-08-17 at 23 36 06

You only need to do this once, the next time you run the command everything should be ready automatically.

Now you have an instant development setup and when you make changes you will see them right into the browser (hot-reloading).

You can see your blog here: http://localhost:3000 and you can access to the admin here: http://localhost:3000/ghost.

Credentials

As of version 2.0.1 of the theme you must provide your own credentials when accessing Ghost Admin for the first time, otherwise, if you are using an earlier version, you must enter the following credentials to gain access:

User: liebling@example.com
Password: 0123456789

Production mode

When you're ready you can build the theme for production just by running npm run production (within the src directory).

This command will generate the file liebling.zip in the root of the theme directory. Now you can upload this file to your own Ghost instance 😎.