Ghost icon indicating copy to clipboard operation
Ghost copied to clipboard

Outdated version of string-width is causing the Docker image entrypoint loading to fail.

Open LaurentGoderre opened this issue 1 year ago • 2 comments

Issue Summary

The update to fix arm32 architecture (https://github.com/TryGhost/Ghost/commit/c2485af853f7b3b86f7f141b8496439cdc4881b4) introduce a regression in the way the Ghost package is launched. When running node index.js there is a module resolution error similar to this issue https://github.com/nrwl/nx/issues/19249. I managed to solve the issue locally by adding "string-width": "4.2.3" to the resolutions section.

Here is the Docker test showing the error: https://github.com/docker-library/ghost/actions/runs/8756974313/job/24034646549

I would like to contribute this fix but I am not sure which package.json to use because the packaged one seems to be generated from the source ones.

Steps to Reproduce

There is probably an more streamlined reproducible but building the Docker image here then running it (https://github.com/docker-library/ghost/tree/master/5/debian)

docker build -t ghost .
docker run --rm ghost 

Ghost Version

5.82.3

Node.js Version

18., 20.

How did you install Ghost?

In Docker using the Ghost CLI

Database type

MySQL 5.7

Browser & OS version

No response

Relevant log / error output

No response

Code of Conduct

  • [X] I agree to be friendly and polite to people in this repository

LaurentGoderre avatar Apr 22 '24 17:04 LaurentGoderre

I'm also seeing this in my docker build. Let me know if I can help provide any more info 👍

zac avatar Apr 23 '24 20:04 zac

Currently I'm using kubernetes and a different approach to the entrypoint. I'm using distroless node 20 debian 12 as the final stage, and the entrypoint is actually a nodejs script which moves the themes and then inits the main function to start ghost. At the moment I'm not having any issue at least with arm64. If it suits you, you can test it out too, because anyways it's still based on the "official" image (at least in the logic and general workflow of the dockerfile)

@sredevopsorg/ghost-on-kubernetes

ngeorger avatar Apr 26 '24 08:04 ngeorger

cc @acburdine :bow: :heart:

(this is currently blocking updates to the ghost Docker image :sob:)

tianon avatar May 08 '24 16:05 tianon

cc @acburdine 🙇 ❤️

(this is currently blocking updates to the ghost Docker image 😭)

Hope this helps (and works 😂) https://github.com/docker-library/ghost/pull/414

ngeorger avatar May 09 '24 08:05 ngeorger

This is weird 🤔

We haven't been seeing this with our internal builds but I do know we've run into it a few times with local dev. I think yarn is hoisting different versions of string-width up to the root, but I'm not entirely sure why

daniellockyer avatar May 09 '24 08:05 daniellockyer

Potentially related to https://github.com/isaacs/jackspeak/issues/5 + https://github.com/storybookjs/storybook/issues/22431#issuecomment-1630086092

daniellockyer avatar May 09 '24 09:05 daniellockyer

This is weird 🤔

We haven't been seeing this with our internal builds but I do know we've run into it a few times with local dev. I think yarn is hoisting different versions of string-width up to the root, but I'm not entirely sure why

The script which runs their tests is where the CI fails, at least as my understanding, probably I0m wrong: https://github.com/ngeorger/ghost/actions/runs/9014939335/job/24768631225#step:7:16

My approach is a bit different, I'm using multi stage builds and running fine on Kubernetes, both arm64 and amd64.

Maybe this helps a bit :) https://github.com/sredevopsorg/ghost-on-kubernetes/blob/19c3c93ec92c9f728a0e99cbf03f5bc490a0e847/Dockerfile#L5

PS: I actually solved many crashes using yarn instead of npm, I guess uou are right :)

Regards from Chile!

ngeorger avatar May 09 '24 09:05 ngeorger

Can people try using Yarn v1.22.22? Apparently they fixed the transitive dependencies bug in that: https://github.com/yarnpkg/yarn/releases/tag/v1.22.22

daniellockyer avatar May 09 '24 09:05 daniellockyer

In fact, I think I'll just add a jackspeak resolution, as that solves it for most people

daniellockyer avatar May 09 '24 09:05 daniellockyer

Let's give this a go 🙂 Let me know if it re-occurs

daniellockyer avatar May 09 '24 10:05 daniellockyer

Does that mean the solution didn't work? Or do we need to wait for next release?

muratcorlu avatar May 09 '24 18:05 muratcorlu

We need to wait for the release (should have checked the history log before opening the PR)

LaurentGoderre avatar May 09 '24 19:05 LaurentGoderre

Yep sorry, next release (today)

daniellockyer avatar May 10 '24 06:05 daniellockyer

JackSpeak resolution was not enough unfortunately https://github.com/docker-library/ghost/actions/runs/9063454953/job/24899459788#step:7:33

LaurentGoderre avatar May 13 '24 13:05 LaurentGoderre

Latest version worked! Thanks all!

LaurentGoderre avatar May 17 '24 17:05 LaurentGoderre

Glad we could get it fixed! Lockfiles hey 🙄

daniellockyer avatar May 20 '24 09:05 daniellockyer