153 lines
3.4 KiB
YAML
153 lines
3.4 KiB
YAML
|
---
|
||
|
kind: pipeline
|
||
|
type: docker
|
||
|
name: deploy
|
||
|
|
||
|
platform:
|
||
|
os: linux
|
||
|
arch: amd64
|
||
|
|
||
|
steps:
|
||
|
- name: print env
|
||
|
image: appleboy/drone-ssh:1.6.2
|
||
|
settings:
|
||
|
envs:
|
||
|
- drone_tag
|
||
|
- drone_commit
|
||
|
- drone_build_number
|
||
|
- drone_repo_name
|
||
|
- drone_repo_namespace
|
||
|
- local_docker_registry
|
||
|
- registry_password
|
||
|
- git_domain
|
||
|
- chat_admin_name
|
||
|
- chat_admin_email
|
||
|
- chat_admin_password
|
||
|
host:
|
||
|
from_secret: ssh-host
|
||
|
key:
|
||
|
from_secret: ssh-key
|
||
|
port:
|
||
|
from_secret: ssh-port
|
||
|
script:
|
||
|
- rm -f env-chat
|
||
|
- "echo \"export LOCAL_DOCKER_REGISTRY='$${LOCAL_DOCKER_REGISTRY}'\" >> env-chat # \"local-docker-registry\""
|
||
|
- "echo \"export REGISTRY_PASSWORD='$${REGISTRY_PASSWORD}'\" >> env-chat # \"registry-password\""
|
||
|
- "echo \"export GIT_DOMAIN='$${GIT_DOMAIN}'\" >> env-chat # \"git-domain\""
|
||
|
- "echo \"export CHAT_ADMIN_NAME='$${CHAT_ADMIN_NAME}'\" >> env-chat # \"chat-admin-name\""
|
||
|
- "echo \"export CHAT_ADMIN_EMAIL='$${CHAT_ADMIN_EMAIL}'\" >> env-chat # \"chat-admin-email\""
|
||
|
- "echo \"export CHAT_ADMIN_PASSWORD='$${CHAT_ADMIN_PASSWORD}'\" >> env-chat # \"chat-admin-password\""
|
||
|
username:
|
||
|
from_secret: ssh-user
|
||
|
environment:
|
||
|
CHAT_ADMIN_EMAIL:
|
||
|
from_secret: chat-admin-email
|
||
|
CHAT_ADMIN_NAME:
|
||
|
from_secret: chat-admin-name
|
||
|
CHAT_ADMIN_PASSWORD:
|
||
|
from_secret: chat-admin-password
|
||
|
GIT_DOMAIN:
|
||
|
from_secret: git-domain
|
||
|
LOCAL_DOCKER_REGISTRY:
|
||
|
from_secret: local-docker-registry
|
||
|
REGISTRY_PASSWORD:
|
||
|
from_secret: registry-password
|
||
|
|
||
|
- name: scp
|
||
|
image: appleboy/drone-scp:1.6.2
|
||
|
settings:
|
||
|
command_timeout: 2m
|
||
|
host:
|
||
|
from_secret: ssh-host
|
||
|
key:
|
||
|
from_secret: ssh-key
|
||
|
port:
|
||
|
from_secret: ssh-port
|
||
|
source:
|
||
|
- .
|
||
|
target: /stack/chat
|
||
|
username:
|
||
|
from_secret: ssh-user
|
||
|
|
||
|
- name: wait
|
||
|
image: alpine
|
||
|
commands:
|
||
|
- sleep 15
|
||
|
|
||
|
- name: "dockerbuild:"
|
||
|
image: docker:dind
|
||
|
commands:
|
||
|
- set -e
|
||
|
- sh .drone/login.sh
|
||
|
- sh .drone/build.sh
|
||
|
- sh .drone/push.sh
|
||
|
- sh .drone/logout.sh
|
||
|
environment:
|
||
|
LOCAL_DOCKER_REGISTRY:
|
||
|
from_secret: local-docker-registry
|
||
|
REGISTRY_PASSWORD:
|
||
|
from_secret: registry-password
|
||
|
volumes:
|
||
|
- name: dockersock
|
||
|
path: /var/run
|
||
|
|
||
|
- name: deploy
|
||
|
image: appleboy/drone-ssh:1.6.2
|
||
|
settings:
|
||
|
envs:
|
||
|
- drone_tag
|
||
|
- drone_commit
|
||
|
- drone_build_number
|
||
|
- drone_repo_name
|
||
|
- drone_repo_namespace
|
||
|
- git_domain
|
||
|
- chat_admin_name
|
||
|
- chat_admin_email
|
||
|
- chat_admin_password
|
||
|
host:
|
||
|
from_secret: ssh-host
|
||
|
key:
|
||
|
from_secret: ssh-key
|
||
|
port:
|
||
|
from_secret: ssh-port
|
||
|
script:
|
||
|
- export CHAT_ADMIN_PASSWORD=$${CHAT_ADMIN_PASSWORD}
|
||
|
- export GIT_DOMAIN=$${GIT_DOMAIN}
|
||
|
- export CHAT_ADMIN_NAME=$${CHAT_ADMIN_NAME}
|
||
|
- export CHAT_ADMIN_EMAIL=$${CHAT_ADMIN_EMAIL}
|
||
|
- set -e
|
||
|
- cd /stack/chat
|
||
|
- sh .drone/login.sh
|
||
|
- sh .drone/pull.sh
|
||
|
- sh .drone/deploy.sh
|
||
|
username:
|
||
|
from_secret: ssh-user
|
||
|
environment:
|
||
|
CHAT_ADMIN_EMAIL:
|
||
|
from_secret: chat-admin-email
|
||
|
CHAT_ADMIN_NAME:
|
||
|
from_secret: chat-admin-name
|
||
|
CHAT_ADMIN_PASSWORD:
|
||
|
from_secret: chat-admin-password
|
||
|
GIT_DOMAIN:
|
||
|
from_secret: git-domain
|
||
|
|
||
|
services:
|
||
|
- name: docker
|
||
|
image: docker:dind
|
||
|
privileged: true
|
||
|
volumes:
|
||
|
- name: dockersock
|
||
|
path: /var/run
|
||
|
- name: ca
|
||
|
path: /etc/docker/certs.d
|
||
|
|
||
|
volumes:
|
||
|
- name: dockersock
|
||
|
temp: {}
|
||
|
- name: ca
|
||
|
host:
|
||
|
path: /etc/docker/certs.d
|
||
|
|
||
|
...
|