Skip to content

Instantly share code, notes, and snippets.

@arkty
Forked from Qurus/.gitlab_ci.yml
Created December 24, 2017 22:46
Show Gist options
  • Save arkty/72789b1af664dd9da2fef59af2aa4d20 to your computer and use it in GitHub Desktop.
Save arkty/72789b1af664dd9da2fef59af2aa4d20 to your computer and use it in GitHub Desktop.
Deploy from Gitlab CI to Dokku
variables:
DOKKU_HOST: 'dokku.host.es'
IP_DOKKU_HOST: '1.2.3.4'
SSH_DOKKU_PORT: '22'
PROJECT_NAME: 'project_name'
stages:
- deploy_to_dokku
deploy_dokku:
stage: deploy_to_dokku
script:
- mkdir -p ~/.ssh
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- echo -e "Host $DOKKU_HOST\n Hostname $IP_DOKKU_HOST\n Port $SSH_DOKKU_PORT\n" >> ~/.ssh/config
- ssh-keyscan -H $DOKKU_HOST >> ~/.ssh/known_hosts
- git push dokku@$DOKKU_HOST:$PROJECT_NAME master
when: manual
only:
- master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment