Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

137
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda