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

feat: [WIP] fix blockers for podman compatibility #110

Closed
wants to merge 2 commits into from

Conversation

johnbcoughlin
Copy link

Relevant issue or PR

On the path to resolving #8.

We can merge this if the changes are considered unoffensive, or we can wait until #33 lands to verify that the changes in here fix an error when building and running with podman.

Description of changes

  • Create the local_requirements directory even in the case where there are none; in this case it will be empty. This is required because podman errors on the COPY local_requirements* ./local_requirements line if the directory doesn't exist.
  • Run chown -R after copying tesseract_api.py into /tesseract. This fixes a permissions error on that file when built by podman.
  • ... possibly more to come ...

Testing done

These changes were arrived at during the process of figuring out what's necessary to build and run a tesseract on the NERSC perlmutter HPC cluster.

License

  • By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • I sign the Developer Certificate of Origin below by adding my name and email address to the Signed-off-by line.
Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

Signed-off-by: Jack Coughlin [email protected]

@johnbcoughlin johnbcoughlin changed the title feat [WIP]: fix blockers for podman compatibility feat: [WIP] fix blockers for podman compatibility Apr 1, 2025
@johnbcoughlin johnbcoughlin marked this pull request as draft April 1, 2025 01:16
Copy link

codecov bot commented Apr 1, 2025

Codecov Report

Attention: Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 68.59%. Comparing base (4448548) to head (b124dea).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
tesseract_core/sdk/engine.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #110      +/-   ##
==========================================
+ Coverage   68.51%   68.59%   +0.07%     
==========================================
  Files          26       26              
  Lines        2547     2547              
  Branches      384      384              
==========================================
+ Hits         1745     1747       +2     
+ Misses        656      654       -2     
  Partials      146      146              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@johnbcoughlin
Copy link
Author

@jpbrodrick89 I did not include the useradd -ou change because I didn't quite understand why it's necessary. Does the nvidia base image already have a user with uid 1000?

@jpbrodrick89
Copy link
Contributor

@jpbrodrick89 I did not include the useradd -ou change because I didn't quite understand why it's necessary. Does the nvidia base image already have a user with uid 1000?

Yes, that's right. We are discussing this in #104 so happy for you to leave off as we can address there. Addressing this is not required to run with Podman and I don't seem to actually need the base image.

Glad the changes didn't fail any tests (had to rerun Windows though for some reason!).

@@ -70,6 +68,9 @@ ENV TESSERACT_NAME="{{ config.name }}" \
COPY --from=build_stage /python-env /python-env
COPY "{{ tesseract_source_directory }}/tesseract_api.py" ${TESSERACT_API_PATH}
Copy link
Contributor

Choose a reason for hiding this comment

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

fyi, you can use COPY --chown=tesseractor:tesseractor here instead of running chown separately on the file.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, we'll need to do the same for copying across extra_packages which was required to get the capsule optimisation file working.

Copy link
Author

Choose a reason for hiding this comment

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

@dionhaefner thanks, that's a good tip. do you prefer doing it file-by-file instead of chown -R on the whole directory at the end? I'm happy with either approach.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I believe this is a best practice that has slightly more well-behaved Docker caching and whatnot.

@dionhaefner
Copy link
Contributor

Including these changes in #112, let me know in case there's more you want to get in.

@dionhaefner dionhaefner closed this Apr 3, 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.

3 participants