Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

119
Visualizações
Compiling and running in different containers

I have a project which compiles to a binary file, and running that binary file exposes some REST APIs.

To compile the project I need docker image A which has the compiler and and all the libraries required to produce the executable. To run the executable (ie. host the service) I can get away with a much smaller image B (just basic linux distro, no need for the compiler).

How does one use docker is such a situation?

about 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

My thinking for this scenario is that you can prepare two base images:

  • The 1st one, which includes compiler and all libs for building your executable, call it base-image:build
  • The 2nd one, as the base image to build your final image to delivery, call it base-image:runtime

And then break your build process into two steps:

  • Step 1: build your executable inside base-image:build, and then put your executable to some place, like NFS or any registry from where you can fetch it for later use;
  • Step 2: write your Dockerfile which FROM base-image:runtime, fetch your artifact/executable from wherever generated by Step 1, docker build your delivery image, and then docker push to your registry for release.

Hope this could be helpful :-)

about 4 years ago · Santiago Trujillo Relatório

0

mkdir local_dir
docker run -dv $PWD/local_dir:/mnt BUILD_CONTAINER

compile code and save it to /mnt in the container. It'll be written to local_dir on your host filesystem and persist after the container is destroyed.

You Should now write a Dockerfile and add a step to copy in the new binary, then build. But for example's sake...

docker run -dv $PWD/local_dir:/mnt PROD_CONTAINER 

Your bin, and everything else in local_dir, will reside in the container at /mnt/

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda