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

226
Visualizações
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 Respostas
Responde à pergunta

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 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