a year 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?
26 Replies
a year ago
bc8937d0-8a92-41f5-b8d9-e0f76d660929
a year ago
Hello!
You can do that with a nixpacks.toml file -
[phases.setup]
aptPkgs = ['...', 'cowsay']a year ago
So I can just add this nixpacks.toml file to the root directory and that does it?
a year ago
yep!
a year ago
Thanks Brody, I would try this out and give feedback
a year 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
a year ago
the build fails for some reason
a year ago
nixpacks.toml
[phases.setup]
nixPkgs = ['libreoffice']
a year ago
please enclose that in tripple backticks
a year ago
```# nixpacks.toml
[phases.setup]
nixPkgs = ['libreoffice']
```
a year ago
tripple backticks please
a year 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 faileda year ago
are you aware you can edit messages in discord?
a year ago
not very familiar with discord haha. only used it to reach out to you guys
a year ago
you are missing the ...
a year ago
oh so it needs to be like this
# nixpacks.toml
[phases.setup]
nixPkgs = ['...', 'libreoffice']a year ago
yep
a year ago
alright, ill give it another go. thanks Brody
a year 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?
a year ago
Please, I need a response
a year ago
@Brody @Adam Please, I need help with this. It is pretty urgent
a year 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
a year ago
Might be best to write yourself up a Dockerfile instead of relying on nix packages
a year ago
the same problem
a year 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.
a year 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 • over 1 year ago
