1

I have Elixir/Phoenix server, based on user requirements server generates markdown and latex files, then it runs System.cmd("pandoc", [relevant commands]) to generate PDF files everything works fine in the local system, here the dependencies are (pandoc and latex) installed locally

now I'm trying to dockerize the project. I tried installing pandoc and latex in phoenix_server container and it worked fine but the final docker image size increased to 8.5GB because texlive itself has 7.5GB so its not an option

I found this pandoc/latex:2.18 image

so my idea is to create 3 docker containers and run docker-compose up

container_1: Phoenix_server
container_2: postgres:14
container_3: pandoc/latex:2.18

but it didn't worked.

challenges:

1 sharing server generated file's with pandoc/latex container, for this I'm thinking to using docker volume option

2 I could not figure out how to run cli commands from phoenix container onto in pandoc/latex container

any help is greatly appreciated

Thank you

Ambareesha Av
  • 21
  • 1
  • 5
  • One container can't call executables in another container or otherwise see its filesystem. If you can wrap an HTTP facade around Pandoc that's the cleanest solution (and the linked question mentions an image that has that), or you can accept that you'll have a single very very large image. – David Maze May 01 '22 at 10:20
  • after considering the complexity involved in my approach changed my idea and somewhere I found this link and tried different combinations of latex distribution installations and modified my Dockerfile, I posted my solution below and thank you – Ambareesha Av May 04 '22 at 06:08

1 Answers1

0
  1. To be fair, if you're not using distributed erlang in this case, I would just install Elixir to the pandoc image and left postgres as an external container / managed db as you did.

  2. When you want to distribute calculations like you are trying with containers, I would probably put some queue (postgres + Oban as a option looks good here) and started elixir process in the pandoc image which can do the rendering and save outputs to the shared volume.

Mikhail Aksenov
  • 561
  • 6
  • 11