manisandro / gImageReader

A Gtk/Qt front-end to tesseract-ocr.
GNU General Public License v3.0
1.57k stars 187 forks source link

Entrypoint Problem with DockerFile #640

Closed og-mrk closed 9 months ago

og-mrk commented 12 months ago

Issue Description

Docker Image not working properly with the commands provided the Wiki, One/two Issues occurred After the process of Building the Docker Image, in other words, the creation of gImageReader Build Env. went well... but the process of making program binaries didn't.

Procedures to Re-create Issue

  1. Install wsl using wsl --update
  2. Enable & Install Windows Hyper-V (Docker depends on it).
  3. Reboot device
  4. Install Docker Desktop you can do it in different ways, using chocolatey package manager choco install docker-desktop Or by visiting the official Docker Desktop webpage
  5. Log out and Log back in (To finish Docker Desktop installation)
  6. Run the Docker Desktop app, It'll take a few seconds, be patient...
  7. Open a new File explorer window, and go to an empty folder (For the next step)
  8. Type powershell.exe in the Address Bar and press Enter (pwsh.exe if you have it installed)
  9. Clone the Repo with git clone "https://github.com/manisandro/gImageReader.git" inside this empty folder
  10. cd (ChangeDirectory) to the Newly cloned repo
  11. Run the following command (Source: Repo Wiki): docker build -t gimagereader_buildenv packaging/win32
  12. Wait for a few minutes, and when the Image is finally done and Written to disk, run the follow command: docker run -v $PWD:/workspace gimagereader_buildenv packaging/win32/makeinstaller.sh x86_64 qt5

First Error (powershell.exe):

At line:1 char:15
+ docker run -v $PWD:/workspace gimagereader_buildenv packaging/win32/m ...
+               ~~~~~
Variable reference is not valid. ':' was not followed by a valid variable name character. Consider using ${} to
delimit the name.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : InvalidVariableReferenceWithDrive

(pwsh.exe)

ParserError:
Line |
   1 |  docker run -v $PWD:/workspace gimagereader_buildenv packaging/win32/m …
     |                ~~~~~
     | Variable reference is not valid. ':' was not followed by a valid variable name character. Consider using ${} to delimit the name.

Solution 😄 :

instead of $PWD:/workspace, make it ${PWD}:/workspace

After fixing this problem, another one rises, which's: exec packaging/win32/makeinstaller.sh: no such file or directory

Solution... at least for me is:

add --entrypoint /bin/sh flag+argument to the docker run command + Make the NewLines of packaging/win32/makeinstaller.sh file Unix LF instead of windows style CRLF

... it's a weird issue I know... but I hope my experience + the solution(s) I've found could help fix it :D