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

Modify docker image WORKDIR to fix find_path() error #131

Merged
merged 1 commit into from
Aug 31, 2023

Conversation

yichao-cai
Copy link
Contributor

Pull Request Title

Fix docker image WORKDIR to avoid path not found error

Related Issue

Description

Using current WORKDIR /data in the build.dockerfile would result in cwd not found error when running get_similarity_score.py.

The error message is as followed:

resume-matcher-resume-matcher-1  | 2023-08-31 09:13:00.039 Uncaught app exception
resume-matcher-resume-matcher-1  | Traceback (most recent call last):
resume-matcher-resume-matcher-1  |   File "/usr/local/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script
resume-matcher-resume-matcher-1  |     exec(code, module.__dict__)
resume-matcher-resume-matcher-1  |   File "/data/streamlit_app.py", line 15, in <module>
resume-matcher-resume-matcher-1  |     from scripts.similarity.get_similarity_score import get_similarity_score, find_path, read_config
resume-matcher-resume-matcher-1  |   File "/data/scripts/similarity/get_similarity_score.py", line 46, in <module>
resume-matcher-resume-matcher-1  |     cwd = find_path('Resume-Matcher')
resume-matcher-resume-matcher-1  |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
resume-matcher-resume-matcher-1  |   File "/data/scripts/similarity/get_similarity_score.py", line 43, in find_path
resume-matcher-resume-matcher-1  |     raise ValueError(f"Folder '{folder_name}' not found.")
resume-matcher-resume-matcher-1  | ValueError: Folder 'Resume-Matcher' not found.

This is because the pwd is at /data and there is no folder named Resume-Matcher. Once the find_path() moves up to the parent path and detected a /, it would exit and throw a "Folder not found" error.

Type

  • Bug Fix
  • Feature Enhancement
  • Documentation Update
  • Code Refactoring
  • Other (please specify):

Proposed Changes

  • Modify WORKDIR in build.dockerfile as WORKDIR /data/Resume-Matcher. This make the find_path() finds the repo folder as cwd.

Screenshots / Code Snippets (if applicable)

FROM python:3.11.0-slim
WORKDIR /data/Resume-Matcher
COPY . .
RUN apt-get update
RUN apt-get install -y build-essential python-dev git
RUN pip install -U pip setuptools wheel
RUN pip install -r requirements.txt
RUN python run_first.py
ENTRYPOINT [ "streamlit", "run", "streamlit_app.py"]

EXPOSE 8501

How to Test

  1. Run docker-compose up.
  2. Open browser to access streamlit app.
  3. Keywords and similarity scores are shown up.

Checklist

  • The code compiles successfully without any errors or warnings
  • The changes have been tested and verified
  • The documentation has been updated (if applicable)
  • The changes follow the project's coding guidelines and best practices
  • The commit messages are descriptive and follow the project's guidelines
  • All tests (if applicable) pass successfully
  • This pull request has been linked to the related issue (if applicable)

Additional Information

Copy link
Owner

@srbhr srbhr left a comment

Choose a reason for hiding this comment

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

Thanks @yichao-cai for this fix.

@srbhr srbhr merged commit 7991881 into srbhr:main Aug 31, 2023
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.

2 participants