You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been racking my head around why my Ghost container on Docker doesn't upload images correctly. A lot of forums pointed out the issue could be with the sharp installation, so I did the following:
Installed older versions of sharp: Versions like 0.24, 0.23, etc with no success. Got tonnes of C++ and Python errors
Disabled imageOptimization in config.production.json
After some debugging, turns out the host machine I was running Ghost on (a beatdown Lenovo Ideapad z575, with Quad Core 1.40GHz AMD A6-3400M Processor) had an extremely old CPU architecture which was not supported by sharp, specially the versions compatible with Ghost.
What to do
I think there should be a more graceful fallback for sharp. I mean, if I don't really want to use it, I should have the option to totally purge it. Plus, it should be able to handle any sort of such issue. Perhaps a try-catch.
Also, if I've disabled imageOptimisation, why does Ghost still try to fetch images of different sizes in production?
Steps to Reproduce
Install docker compose of Ghost on a CPU of old architecture:
No log errors. The blog just crashes.
When I went into the docker container's bash, and ran sharp directly, it gave me "illegal instruction (core dumped)", which made me believe that sharp wasn't built for my CPU's architecture.
Code of Conduct
I agree to be friendly and polite to people in this repository
The text was updated successfully, but these errors were encountered:
I've found a temporary workaround, after going through some of Ghost's code. It seems like there is a check which prevents sharp from running at all, here.
So the solution was to:
Enter the docker container
cd ./current
Run yarn remove sharp, and then,
Run rm -rf node_modules/sharp
To completely uninstall and clean sharp.
You would also need to add this to config.production.json:
{
...imageOptimisation: false
}
Doing the above completely disabled sharp and now allows me to upload images (albeit, the images are a bit large, but I can make do :D)
Issue Summary
Summary
I've been racking my head around why my Ghost container on Docker doesn't upload images correctly. A lot of forums pointed out the issue could be with the sharp installation, so I did the following:
After some debugging, turns out the host machine I was running Ghost on (a beatdown Lenovo Ideapad z575, with Quad Core 1.40GHz AMD A6-3400M Processor) had an extremely old CPU architecture which was not supported by sharp, specially the versions compatible with Ghost.
What to do
I think there should be a more graceful fallback for sharp. I mean, if I don't really want to use it, I should have the option to totally purge it. Plus, it should be able to handle any sort of such issue. Perhaps a try-catch.
Also, if I've disabled imageOptimisation, why does Ghost still try to fetch images of different sizes in production?
Steps to Reproduce
false
Ghost Version
5.82.2
Node.js Version
18.20.2
How did you install Ghost?
Docker on Ubuntu 22.04.4 LTS, Lenovo IdeaPad Z575 (https://www.bhphotovideo.com/c/product/793706-REG/Lenovo_129925U_IdeaPad_Z575_15_6_Notebook.html)
Database type
MySQL 5.7
Browser & OS version
No response
Relevant log / error output
Code of Conduct
The text was updated successfully, but these errors were encountered: