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

225
Vistas
Execute external bash script inside GitLab-ci Docker build

I would like to execute an external (on the local machine) bash script from gitlab-ci.yml which uses the docker:stable image. I would like to execute startup.sh located outside the gitlab docker image. Is this possible or are there better options?

gitlab-ci.yaml

image: docker:stable

#Build script

variables:
  CI_DEBUG_TRACE: "true"
  DOCKER_DRIVER: overlay

before_script:
  - docker --version

build:
  services:
  - docker:dind
  script:
    - docker build --no-cache -t <tag> .
    - docker login -u root -p <pass> <registry>
    - docker tag ...
    - docker push ...
    - echo "build completed"
  stage: build
  tags:
    - <tag>

deploy_staging:
  stage: deploy
  script:
    - ./sh startup.sh

bash script

#!/bin/bash

docker login -u root -p <pass>
docker pull <image>
docker-compose up -d
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

I am not sure if this is the best practice for your use-case but the simple way to share files with an image is to add volume and share this code to the image by editing your config.toml file .

add this line to config.toml under [runners.docker]

volumes = ["/cache",path to startup.sh:/root/scripts"]

and then inside your.gilatb.yml

    deploy_staging:
      stage: deploy
      script:
        - chmod +x /root/scripts/startup.sh     
        - ./sh /root/scripts/startup.sh
over 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