This repository has been archived on 2020-08-11. You can view files and clone it, but cannot push or open issues or pull requests.
stack/.drone.do.yml

157 lines
3.2 KiB
YAML

---
kind: pipeline
type: docker
name: default
clone:
# skip_verify: true
steps:
steps:
- name: wait
when:
branch:
- do
image: docker:dind
volumes:
- name: dockersock
path: /var/run
commands:
- sleep 60
- name: build-letsencrypt-nginx
when:
branch:
- do
image: docker:dind
volumes:
- name: dockersock
path: /var/run
environment:
LOCAL_DOCKER_REGISTRY:
from_secret: local-docker-registry
commands:
- cd letsencrypt-nginx
- docker build . -t $${LOCAL_DOCKER_REGISTRY}letsencrypt-nginx
- docker push $${LOCAL_DOCKER_REGISTRY}letsencrypt-nginx
- name: build-letsencrypt-do
when:
branch:
- do
image: docker:dind
volumes:
- name: dockersock
path: /var/run
environment:
LOCAL_DOCKER_REGISTRY:
from_secret: local-docker-registry
commands:
- cd letsencrypt-nginx
- sh build.sh do $${LOCAL_DOCKER_REGISTRY}
- name: clear
when:
branch:
- do
image: appleboy/drone-ssh
settings:
host:
from_secret: ssh-host
username:
from_secret: ssh-user
key:
from_secret: ssh-key
passphrase:
from_secret: ssh-passphrase
port:
from_secret: ssh-port
script:
- rm -r -f ~/stack-deploy
- name: scp files
when:
branch:
- do
image: appleboy/drone-scp
settings:
host:
from_secret: ssh-host
username:
from_secret: ssh-user
key:
from_secret: ssh-key
passphrase:
from_secret: ssh-passphrase
port:
from_secret: ssh-port
command_timeout: 2m
target: ~/stack-deploy
source:
- .
- name: deploy
when:
branch:
- do
image: appleboy/drone-ssh
environment:
DRONE_RPC_SECRET:
from_secret: drone-rpc-secret
DRONE_GITEA_CLIENT_ID:
from_secret: drone-gitea-client-id
DRONE_GITEA_CLIENT_SECRET:
from_secret: drone-gitea-client-secret
LOCAL_DOCKER_REGISTRY:
from_secret: local-docker-registry
SSH_USER:
from_secret: ssh-user
CERTBOT_EMAIL:
from_secret: certbot-email
GIT_DOMAIN:
from_secret: git-domain
settings:
envs:
- drone_rpc_secret
- drone_gitea_client_id
- drone_gitea_client_secret
- ssh_user
- local_docker_registry
- certbot_email
- git_domain
host:
from_secret: ssh-host
username:
from_secret: ssh-user
key:
from_secret: ssh-key
passphrase:
from_secret: ssh-passphrase
port:
from_secret: ssh-port
script:
- set -e
- export LOCAL_DOCKER_REGISTRY=$LOCAL_DOCKER_REGISTRY
- export DRONE_RPC_SECRET=$DRONE_RPC_SECRET
- export DRONE_GITEA_CLIENT_ID=$DRONE_GITEA_CLIENT_ID
- export DRONE_GITEA_CLIENT_SECRET=$DRONE_GITEA_CLIENT_SECRET
- export SSH_USER=$SSH_USER
- export CERTBOT_EMAIL=$CERTBOT_EMAIL
- export GIT_DOMAIN=$GIT_DOMAIN
- docker network prune -f
- cd ~/stack-deploy
- docker stack rm gitea
- sleep 60
- docker stack deploy -c docker-compose-do.yml gitea
- docker service scale gitea_chat=1
#- sleep 300
services:
- name: docker
image: docker:dind
privileged: true
volumes:
- name: dockersock
path: /var/run
volumes:
- name: dockersock
temp: {}