9 months ago
I am building a feature to extract text from .ppt files in my application. I am using libreoffice-convert to do this, however, I need the actual libre office application installed on the server for it to work. Is it possible to ssh into the server and do a sudo apt install?
3 Replies
9 months ago
bc8937d0-8a92-41f5-b8d9-e0f76d660929
9 months ago
Hello!
You can do that with a nixpacks.toml file -
[phases.setup]
aptPkgs = ['...', 'cowsay']
9 months ago
So I can just add this nixpacks.toml file to the root directory and that does it?
9 months ago
yep!
9 months ago
Thanks Brody, I would try this out and give feedback
9 months ago
15 [stage-0 11/15] RUN --mount=type=cache,id=s/f8624550-8b68-46f9-8631-b118ef743732-/root/npm,target=/root/.npm npm ci
15 0.243 /bin/bash: line 1: npm: command not found
15 ERROR: process "/bin/bash -ol pipefail -c npm ci" did not complete successfully: exit code: 127
[stage-0 11/15] RUN --mount=type=cache,id=s/f8624550-8b68-46f9-8631-b118ef743732-/root/npm,target=/root/.npm npm ci:
0.243 /bin/bash: line 1: npm: command not found
Dockerfile:26
24 | ENV NIXPACKSPATH=/app/nodemodules/.bin:$NIXPACKS_PATH
25 | COPY . /app/.
26 | >>> RUN --mount=type=cache,id=s/f8624550-8b68-46f9-8631-b118ef743732-/root/npm,target=/root/.npm npm ci
27 |
28 | # build phase
ERROR: failed to solve: process "/bin/bash -ol pipefail -c npm ci" did not complete successfully: exit code: 127
Error: Docker build failed
9 months ago
the build fails for some reason
9 months ago
nixpacks.toml
[phases.setup]
nixPkgs = ['libreoffice']
9 months ago
please enclose that in tripple backticks
9 months ago
```# nixpacks.toml
[phases.setup]
nixPkgs = ['libreoffice']
```
9 months ago
tripple backticks please
9 months ago
#15 [stage-0 11/15] RUN --mount=type=cache,id=s/f8624550-8b68-46f9-8631-b118ef743732-/root/npm,target=/root/.npm npm ci
#15 0.243 /bin/bash: line 1: npm: command not found
#15 ERROR: process "/bin/bash -ol pipefail -c npm ci" did not complete successfully: exit code: 127
-----
> [stage-0 11/15] RUN --mount=type=cache,id=s/f8624550-8b68-46f9-8631-b118ef743732-/root/npm,target=/root/.npm npm ci:
0.243 /bin/bash: line 1: npm: command not found
-----
Dockerfile:26
-------------------
24 | ENV NIXPACKS_PATH=/app/node_modules/.bin:$NIXPACKS_PATH
25 | COPY . /app/.
26 | >>> RUN --mount=type=cache,id=s/f8624550-8b68-46f9-8631-b118ef743732-/root/npm,target=/root/.npm npm ci
27 |
28 | # build phase
-------------------
ERROR: failed to solve: process "/bin/bash -ol pipefail -c npm ci" did not complete successfully: exit code: 127
Error: Docker build failed
9 months ago
are you aware you can edit messages in discord?
9 months ago
not very familiar with discord haha. only used it to reach out to you guys
9 months ago
you are missing the ...
9 months ago
oh so it needs to be like this
# nixpacks.toml
[phases.setup]
nixPkgs = ['...', 'libreoffice']
9 months ago
yep
9 months ago
alright, ill give it another go. thanks Brody
9 months ago
So after trying this, the application build. For some reason, I still get an error when trying to use the package which says: Could not find soffice binary
I'm not sure why this happens, I also tried specifying the path like so:
# nixpacks.toml
[phases.setup]
nixPkgs = ['...', 'libreoffice']
[phases.build]
cmds = ['...', 'ln -s $(which soffice) /usr/local/bin/soffice']
But to no avail. Any ideas?
9 months ago
Please, I need a response
9 months ago
@Brody @Adam Please, I need help with this. It is pretty urgent
9 months ago
I’m sorry, but it is the weekend. This channel is primarily for community help, if someone has time they will help, but there is no guarantee
9 months ago
Might be best to write yourself up a Dockerfile instead of relying on nix packages
9 months ago
the same problem
9 months ago
Maybe you need to use convertWithOptions when using libreoffice-convert. In convertWithOptions, you can specify the path of the binary file. But there is a problem. After I installed libreoffice, I can't find the specific path. I haven't found a way to enter the container and execute which libreoffice.
9 months ago
finally done!
1.
[phases.setup]
nixPkgs = ['...', 'libreoffice']
2.
import { execSync } from 'child_process';
const sofficeLocation = execSync('which soffice').toString().trim();
console.log(`sofficeLocation: ${sofficeLocation}`);
const convert = util.promisify(convertAsync.convertWithOptions);
const options = {
sofficeBinaryPaths: [sofficeLocation],
};
return convert(pptBuffer, 'pdf', undefined, options);
Status changed to Solved brody • 9 months ago