Sign inSign up

alamaby/ssh

By alamaby

•Updated about 7 years ago

Base image: ubuntu:19.04 Added packages: openssh-client sshpass

Image
0

906

alamaby/ssh repository overview

⁠Overview

Sometimes I need to run command on remote server, such as doing git operation.

  • Base image: ubuntu:19.04
  • Added packages:
    • openssh-client
    • sshpass

⁠Sample .gitlab-ci.yml to use with GitLab

Put the password in DEV_SSH_PASS variable using Settings -> CI / CD -> Variables.

variables:
  DEV_SERVER_USER: "web"
  DEV_SERVER_HOST: "dev.example.id"
  DEV_SERVER_PORT: "22"
  DEV_SERVER_WORKDIR: "/var/www/html/mygitproject"

deploy:development:
  image: alamaby/ssh:0.1.0
  stage: deploy
  only:
    - master
  script:
    - eval $(ssh-agent -s)
    - shopt -s expand_aliases
    - alias runssh="sshpass -e ssh -o StrictHostKeyChecking=no"
    - export SSHPASS=${DEV_SSH_PASS}
    - runssh -p ${DEV_SERVER_PORT} ${DEV_SERVER_USER}@${DEV_SERVER_HOST} "cd ${DEV_SERVER_WORKDIR} && git add -A && git stash save && git checkout master && git pull && git stash pop"

Tag summary

Content type

Image

Digest

Size

38.7 MB

Last updated

about 7 years ago

docker pull alamaby/ssh:0.1.0