R
Railway•15mo ago
heiningair

making linux program available in nixpacks

Hi, I want to run a golang app on railway. Within this app i use the following dependency https://github.com/sajari/docconv This tool has some dependencies by itself. I try to install these deps using nixpacks:
# https://nixpacks.com/docs/configuration/file

# set up variables
[variables]

# install all dependencies
[phases.dependencies]
dependsOn = ['setup'] # make sure this phase runs after the default 'setup' phase
aptPkgs= ['poppler-utils','wv','unrtf','tidy'] # install dependencies for docconv "pdftotext"
cmds = [
'go get github.com/JalfResi/justext',
'which pdftotext',
'echo $PATH'
]
# https://nixpacks.com/docs/configuration/file

# set up variables
[variables]

# install all dependencies
[phases.dependencies]
dependsOn = ['setup'] # make sure this phase runs after the default 'setup' phase
aptPkgs= ['poppler-utils','wv','unrtf','tidy'] # install dependencies for docconv "pdftotext"
cmds = [
'go get github.com/JalfResi/justext',
'which pdftotext',
'echo $PATH'
]
When i run it builds correctly and also the which command shows that it is aware of the pdftotext tool, as well as it is sitting in the $PATH ! When i then run the golang app and try to use the pdftotext tool under the hood like i would do it locally (where it works) it spits out that it cant find the tool in the PATH:
exec: "pdftotext": executable file not found in $PATH
exec: "pdftotext": executable file not found in $PATH
What am I doing wrong? Is there any nixpacks trick or config var I need to set before that works like intended? thx in advance! id: 36ee9888-697b-488f-8b20-0269418eaf48 (private project though) relevant build output:
#0 building with "default" instance using docker driver

..........
#13 [stage-0 7/13] RUN go get github.com/JalfResi/justext
#13 1.518 go: downloading github.com/JalfResi/justext v0.0.0-20221106200834-be571e3e3052
#13 2.978 go: downloading github.com/levigross/exp-html v0.0.0-20120902181939-8df60c69a8f5
#13 DONE 3.7s
#14 [stage-0 8/13] RUN which pdftotext
#14 0.619 /bin/pdftotext
#14 DONE 0.7s
#15 [stage-0 9/13] RUN echo /nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin:/bin:/sbin:/usr/bin:/usr/sbin
#15 0.690 :/root/.nix-profile/bin:/root/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/root/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin:/bin:/sbin:/usr/bin:/usr/sbin
#0 building with "default" instance using docker driver

..........
#13 [stage-0 7/13] RUN go get github.com/JalfResi/justext
#13 1.518 go: downloading github.com/JalfResi/justext v0.0.0-20221106200834-be571e3e3052
#13 2.978 go: downloading github.com/levigross/exp-html v0.0.0-20120902181939-8df60c69a8f5
#13 DONE 3.7s
#14 [stage-0 8/13] RUN which pdftotext
#14 0.619 /bin/pdftotext
#14 DONE 0.7s
#15 [stage-0 9/13] RUN echo /nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin:/bin:/sbin:/usr/bin:/usr/sbin
#15 0.690 :/root/.nix-profile/bin:/root/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/root/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin:/bin:/sbin:/usr/bin:/usr/sbin
GitHub
GitHub - sajari/docconv: Converts PDF, DOC, DOCX, XML, HTML, RTF, e...
Converts PDF, DOC, DOCX, XML, HTML, RTF, etc to plain text - GitHub - sajari/docconv: Converts PDF, DOC, DOCX, XML, HTML, RTF, etc to plain text
4 Replies
Percy
Percy•15mo ago
Project ID: 36ee9888-697b-488f-8b20-0269418eaf48
Brody
Brody•15mo ago
nixpacks is likely trying to run your go app in a separate slim image, to disable this set a service variable CGO_ENABLED = 1
heiningair
heiningairOP•15mo ago
that helped a lot! Thank you kindly!!
Brody
Brody•15mo ago
no problem 🙂
Want results from more Discord servers?
Add your server