I am trying to solve a issue where i need to build the ghost image. Is there any way i can achieve that?
What exactly is the issue you are facing?
We have a bug fix for the issue, Type error within hash function during setting up Ā· Issue #16918 Ā· TryGhost/Ghost Ā· GitHub and to test it locally we need to build the docker image locally. Wanted to know if there is a way to achieve this?
This is the current Dockerfile (5.71.0).
You can build the docker image locally by duplicating and editing it.
Hereās how Iād do it:
- Build your local fix with
yarn archive
: Ghost Docs - Edit the Dockerfile to copy the local .tar archive to the build filesystem
- Edit line 55 to use the local archive rather than a downloaded remote version. You can use the
--archive
flag for that, which is mentioned here under āOptionsā. - Run the docker image.
I am getting the following error while running the build command
Debug Information:
OS: Debian GNU/Linux, v11
Node Version: v18.18.2
Ghost-CLI Version: 1.25.3
Environment: production
Command: āghost install --archive ghost/core/ghost-5.70.2.tgz --db mysql --dbhost mysql --no-prompt --no-stack --no-setup --dir /var/lib/ghostā
Message: A supported archive file could not be found.
Looks like you havenāt actually copied the archive to the Docker file system.
You need to do that, so whatever commands you write inside your Dockerfile can actually access it. If itās still on your host file system, docker will not have access to that.
Hereās the documentation on that: Dockerfile reference | Docker Docs
In practice, it will look somewhat like this (this is directly from the Dockerfile I use to build custom docker images for Magic Pages, the Ghost host I am running):
# Copy custom ghost archive to /tmp
COPY /path/to/archive/archive.tgz /tmp
# Install Ghost from archive
RUN ghost install --archive /tmp/archive.tgz --no-prompt --no-setup --no-start
So, obviously you will need to adapt that a bit ā but you get the idea
@jannis I am facing the same issue as TS.
The archive definitely gets into the image during the building process from previous stage, still no luck.
Apart from that, I get the same error if I just pull the official repo locally and run:
$ npm install --global nx
$ yarn install
$ yarn archive
$ ghost install --archive ./ghost/core/ghost-5.74.5.tgz --dir ~/ghost_installed
Result:
Message: A supported archive file could not be found.
Debug Information:
OS: Debian GNU/Linux, v12
Node Version: v18.19.0
Ghost-CLI Version: 1.25.3
Environment: production
The archive path and name are absolutely correct. Any ideas what is going wrong?
Hey Sergei!
I managed to replicate this and played around a little bit. Interestingly, it worked when I provided an absolute path for the archive:
ghost install --dir ~/ghost_instatlled --archive /Users/jannis/blabla/ghost/core/ghost-5.74.5.tgz
(obviously replace the /Users/jannis/blabla
with the location of your Ghost directory)
Not entirely sure why though. I had a look at the CLIās source code and this logic should mitigate that behaviour, in my opinion:
So, canāt get to the bottom of it right now, but using the absolute path should fix it for you