service-forgejo/.drone.yml

96 lines
2.3 KiB
YAML
Raw Normal View History

2023-02-21 11:45:44 +00:00
---
kind: pipeline
type: docker
name: default
steps:
- name: debug
image: alpine
environment:
commands:
- 'echo "Repository: glenux/service-forgejo"'
- 'echo "Git commit: ${DRONE_COMMIT_SHA:0:8}"'
- name: publish:commit_sha
image: plugins/docker
# pull: never
# volumes:
# - name: cache
# path: /stupid
environment:
DOCKER_REPO: glenux/service-forgejo
settings:
username:
from_secret: DOCKERHUB_USERNAME
password:
from_secret: DOCKERHUB_PASSWORD
cache_from: "glenux/service-forgejo:latest_${DRONE_BRANCH/\\//-}"
repo: glenux/service-forgejo
tags: "${DRONE_COMMIT_SHA:0:8}"
purge: false
- name: publish:commit_branch
image: plugins/docker
# volumes:
# - name: cache
# path: /stupid
settings:
username:
from_secret: DOCKERHUB_USERNAME
password:
from_secret: DOCKERHUB_PASSWORD
cache_from: "glenux/service-forgejo:latest_${DRONE_BRANCH/\\//-}"
repo: glenux/service-forgejo
tags: "latest_${DRONE_BRANCH/\\//-}"
purge: false
when:
branch:
- "master"
- "develop"
- "feature/*"
- name: publish:latest
image: plugins/docker
settings:
username:
from_secret: DOCKERHUB_USERNAME
password:
from_secret: DOCKERHUB_PASSWORD
cache_from: "glenux/service-forgejo:latest_${DRONE_BRANCH/\\//-}"
repo: glenux/service-forgejo
tags: latest
purge: false
when:
branch:
- master
2023-02-21 11:53:24 +00:00
- name: deploy:dokku
image: alpine
environment:
SSH_USER:
from_secret: SSH_USER
SSH_HOST:
from_secret: SSH_HOST
SSH_PRIVATE_KEY:
from_secret: SSH_PRIVATE_KEY
commands:
2023-02-21 12:13:57 +00:00
- echo $SSH_USER
- echo $SSH_HOST
- echo $SSH_PRIVATE_KEY
2023-02-21 12:09:02 +00:00
- apk update && apk add openssh-client
2023-02-21 12:01:48 +00:00
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
2023-02-21 12:17:38 +00:00
- echo "$SSH_PRIVATE_KEY" | base64 -d > ~/.ssh/deploy_key
2023-02-21 11:57:55 +00:00
- chmod 600 ~/.ssh/deploy_key
2023-02-21 12:23:37 +00:00
- |
ssh -o StrictHostKeyChecking=no \
-i ~/.ssh/deploy_key \
"$SSH_USER@$SSH_HOST" \
dokku git:from-image code \
"glenux/service-forgejo:${DRONE_COMMIT_SHA:0:8}"
2023-02-21 11:53:24 +00:00
2023-02-21 11:45:44 +00:00
# volumes:
# - name: cache
# temp: {}
#