2022-01-06 19:50:43 +01:00
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: build
|
|
|
|
trigger:
|
|
|
|
event:
|
|
|
|
- push
|
|
|
|
steps:
|
|
|
|
- name: tag-image
|
|
|
|
image: alpine
|
|
|
|
commands:
|
|
|
|
- echo '${DRONE_COMMIT:0:8},latest' > .tags
|
|
|
|
- name: clone-submodules
|
|
|
|
image: alpine/git
|
2022-01-06 19:58:53 +01:00
|
|
|
environment:
|
|
|
|
SSH_KEY:
|
|
|
|
from_secret: ssh_git_key
|
2022-01-06 19:50:43 +01:00
|
|
|
commands:
|
2022-01-06 19:58:53 +01:00
|
|
|
- mkdir -p /root/.ssh
|
|
|
|
- echo "$${SSH_KEY}" > /root/.ssh/id_rsa
|
|
|
|
- chmod 600 /root/.ssh/id_rsa
|
|
|
|
- ssh-keyscan github.com > /root/.ssh/known_hosts
|
|
|
|
- ssh-keyscan git.c0ntroller.de >> /root/.ssh/known_hosts
|
2022-01-06 19:50:43 +01:00
|
|
|
- git submodule update --init --recursive
|
2022-01-06 20:25:52 +01:00
|
|
|
- name: secrets
|
|
|
|
image: alpine
|
|
|
|
environment:
|
|
|
|
SECRETS_JSON:
|
|
|
|
from_secret: secrets_json
|
|
|
|
commands:
|
|
|
|
- echo "$${SECRETS_JSON}" > secrets.json
|
2022-01-06 19:50:43 +01:00
|
|
|
- name: build-image
|
|
|
|
image: plugins/docker
|
|
|
|
settings:
|
|
|
|
username:
|
|
|
|
from_secret: docker_user
|
|
|
|
password:
|
|
|
|
from_secret: docker_token
|
|
|
|
registry:
|
|
|
|
from_secret: registry_host
|
|
|
|
repo:
|
|
|
|
from_secret: local_repo
|
|
|
|
insecure: true
|
|
|
|
---
|
|
|
|
kind: pipeline
|
|
|
|
type: ssh
|
|
|
|
name: deploy
|
|
|
|
depends_on:
|
|
|
|
- build
|
|
|
|
trigger:
|
|
|
|
branch:
|
|
|
|
- senpai
|
|
|
|
event:
|
|
|
|
- push
|
|
|
|
server:
|
|
|
|
host:
|
|
|
|
from_secret: ssh_host
|
|
|
|
user:
|
|
|
|
from_secret: ssh_user
|
|
|
|
ssh_key:
|
|
|
|
from_secret: ssh_key
|
|
|
|
steps:
|
|
|
|
- name: deploy
|
|
|
|
when:
|
|
|
|
branch:
|
|
|
|
- senpai
|
|
|
|
environment:
|
|
|
|
DOCKER_USER:
|
|
|
|
from_secret: docker_user
|
|
|
|
DOCKER_PASS:
|
|
|
|
from_secret: docker_token
|
|
|
|
REGISTRY_HOST:
|
|
|
|
from_secret: registry_host
|
|
|
|
IMAGE: infoscreen:latest
|
|
|
|
commands:
|
|
|
|
#- docker login -u $${DOCKER_USER} -p $${DOCKER_PASS}
|
|
|
|
- docker-compose -p infoscreen -f docker-compose.yml rm -s -v -f
|
|
|
|
- docker rmi $${REGISTRY_HOST}/$${IMAGE} || true
|
|
|
|
- docker pull $${REGISTRY_HOST}/$${IMAGE}
|
|
|
|
- docker-compose -p infoscreen -f docker-compose.yml up --no-build -d
|