Skip to content

GenkaOk/gitlab-deploy-ssh

 
 

Repository files navigation

gitlab-deploy-ssh

dockeri.co

Build Status

Docker Image with alpine linux for deploy with ssh in gitlab ci

Supported tags and respective Dockerfile links

Instructions

  1. Create a new SSH key pair locally with ssh-keygen
  2. Copy the public key to the servers you want to have access to (usually in ~/.ssh/authorized_keys).
  3. Create a new secret variable. As Key enter the name SSH_PRIVATE_KEY and in the Value field paste the content of your private key that you created earlier.
  4. Create a new secret variable. As Key enter the name SSH_HOST and in the Value field paste the IP or domain of the server.
  5. Create a new secret variable. As Key enter the name SSH_USER and in the Value field paste the user ssh.
  6. Add a deploy stage en your .gitlab-ci.yml. For example:
production:
  image: lgatica/gitlab-deploy-ssh
  stage: deploy
  script:
    - ssh $SSH_USER@$SSH_HOST 'docker pull your-image:latest'
    - ssh $SSH_USER@$SSH_HOST 'docker-compose up -d your-app'
  environment: production
  only:
    - master

About

Docker Image with alpine linux for deploy with ssh in gitlab ci

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 54.2%
  • Dockerfile 45.8%