srbhr / Resume-Matcher

Resume Matcher is an open source, free tool to improve your resume. It works by using language models to compare and rank resumes with job descriptions.
https://www.resumematcher.fyi/
Apache License 2.0
4.92k stars 2.11k forks source link

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

Closed yichao-cai closed 1 year ago

yichao-cai commented 1 year ago

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

Proposed Changes

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

Additional Information