1

i want to deploy my docker images into a public remote server and in that server i will connect it to my gitlab container registy to pull images and run docker-compose (in the server)

my problem is how can i ssh to that server using gitlab ci file ?

gitlab ci.yml file

stages:
  - build
cache:
  key: ${CI_COMMIT_REF_SLUG}
  paths:
    - .cache/
build:
  image: docker:19.03.12
  stage: build 
  services:
    - docker:19.03.12-dind
  variables:
    IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
  script:
    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
    - docker build -t registry.gitlab.com/ossama.mahjour97/test-dockerfile/myimage .
    - docker push registry.gitlab.com/ossama.mahjour97/test-dockerfile/myimage

1 Answers1

1

it works perfictly by using sshpass

  • Can you add a bit more details? Like what your gitlab-ci.yml looks like with that option? – VonC Apr 21 '21 at 12:44