Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker build image locales error #1362

Closed

Conversation

tristanrobert
Copy link
Contributor

@tristanrobert tristanrobert commented Jan 6, 2025

Fixes #1361

Context

Proposed solution

Add /static/locales in container before build and remove it after.

Related issues

Has this been tested?

  • 👍 yes, I added tests to the test suite
  • 💭 no, because this PR is a draft and still needs work
  • 🙅 no, because this is not relevant here
  • 🙋 no, because I need help

Screenshots / Screencasts

RUN yarn run build:prod
RUN rm -rf /grist/static/locales
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I may be wrong, but I fear it would not be as simple as this.

The fact is that yarn run build:prod invokes a tool to sanitize the localized strings. If we place them just to make yarn run build:prod work, but remove them right after, I think there would be no point for introducing this util: #1354

Copy link
Member

@paulfitz paulfitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this @tristanrobert !

RUN yarn run build:prod
RUN rm -rf /grist/static/locales
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. The error seems to come from a new sanitization step applied to the locales, as @fflorent noted here #1361 (comment). If the sanitization step has an effect, does that effect get propagated to the final image? Reading this, I'm worried an unsanitized version of the locale files ends up in the final image.

Would like @berhalak and @georgegevoian's opinions, they should be back from breaks tomorrow and Wednesday respectively.

(Side note: I wonder if something that needs sanitization is found, the build should break rather than try to continue? Not sure if this new step is there to support some desired syntax or to avoid some undesired syntax. If the latter, failing loudly might be the right thing to do.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this line to avoid the 151 line error:

# Finalize static directory
RUN \
  mv /grist/static-built/* /grist/static && \
  rmdir /grist/static-built

It has error:

=> ERROR [stage-5 23/25] RUN   mv /grist/static-built/* /grist/static &&   rmdir /grist/static-built
------
 > [stage-5 23/25] RUN   mv /grist/static-built/* /grist/static &&   rmdir /grist/static-built:
0.443 mv: inter-device move failed: '/grist/static-built/locales' to '/grist/static/locales'; unable to remove target: Directory not empty

I think there is a problem in the steps order: locales are not sanitized at the right time in docker image build.

Copy link
Member

@paulfitz paulfitz Jan 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tristanrobert that makes sense. @berhalak has tweaked the script to just fail if the translations are detected to contain dodgy material, and included the Dockerfile update (#1367). Thanks for your help with this!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code is finally included in #1367 so it could be closed.

@paulfitz
Copy link
Member

paulfitz commented Jan 8, 2025

Fixed elsewhere #1362 (comment), thanks @tristanrobert

@paulfitz paulfitz closed this Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docker build image locales error
3 participants