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

136
Visualizações
Web application docker swarm where to put source code?

I'm using Docker and Docker compose for a PHP-FPM/Nginx/Mariadb application development. I want to use it now in production with Docker swarm and docker-compose v3 (via docker-stack.yml)

My docker-stack file is like that:

version: "3"
services:

db:
    image: mariadb
    environment:
        MYSQL_ROOT_PASSWORD: root
        MYSQL_DATABASE: app
php:
    image: <MYREGISTRY>/php
    volumes:
        - app-data:/var/www/app
    deploy:
      replicas: 2

nginx:
    image: <MYREGISTRY>/nginx
    depends_on:
      - php
    volumes:
        - app-data:/var/www/app
    deploy:
      replicas: 2
    ports:
      - "80:80"

volumes:
  app-data:

As you can see I use my own private registry to store applications images. My question is where do I put my code source?

I see 2 options:

  • New service app (based on busybox image?) to be a data-only container. Then I can push code source image to my registry and deploy. It can be convenient to have a Docker image with tagged code source.
  • Copy code in PHP image or Nginx image?

Which is the best option?

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

0

The maintenance of the source code should be independent of the maintenance of the docker images. By pushing a docker image containing the source code, into the registry, only to maintain the source code, your first option seems to mix the two together.

Keep the source code on a VCS (version control system). When the code is ready to be distributed, build a docker image with that code. It'd be less overall maintenance if the image has access to the source code directly from the VCS.

You could explore multi-stage docker builds, where temporary containers can be created which connect to the VCS, pulls the appropriate code and builds it if necessary. Then the final image only copies the result of the build process from the temp container, without needing unnecessary access to the VCS.

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