hotfix: fixed docker build crash due to dynamic Python env version fetching#1348
Merged
Conversation
Member
|
Thanks @thesanogoeffect! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi,
Running
docker build -t grobid/grobid:0.8.3-SNAPSHOT --build-arg GROBID_VERSION=0.8.3-SNAPSHOT --file Dockerfile.delft .(as per https://grobid.readthedocs.io/en/latest/Grobid-docker/) resulted in the following error:124 | 125 | # Get the Python version dynamically and set LD_LIBRARY_PATH accordingly 126 | >>> ENV PYTHON_VERSION=$(python3 --version | cut -d' ' -f2 | cut -d'.' -f1,2) 127 | ENV LD_LIBRARY_PATH=/usr/local/lib/python${PYTHON_VERSION}/dist-packages/jep:grobid-home/lib/lin-64:grobid-home/lib/lin-64/jep:${LD_LIBRARY_PATH} 128 | # remove libjep.so because we are providing our own version in the virtual env above -------------------- ERROR: failed to build: failed to solve: Syntax error - can't find = in "--version". Must be of the form: name=value
This was due to the incorrect dynamic Python version ENV fetching in Dockerfile.delft (the same issue was in Dockerfile.evaluation). This doesn't work in Docker because ENV cannot execute shell commands.
According to git history, this change was introduced in e20e653 and included in yesterday's homfunc merge.
After considering how to fix this approach, I reverted back to effectively hardcoding the Python version, which seems cleaner here. I've also ensured that all ENV variables follow the key=value syntax to avoid warnings and linter messages.
Best,
Jakub